-
Notifications
You must be signed in to change notification settings - Fork 53
move tests into dedicated packages #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package DestructableTests | ||
| import Destructable | ||
| import Wurstunit | ||
|
|
||
| @Test function testDestructables() | ||
| let destr = createDestructable(0, ZERO2, 0 .fromDeg(), 1, -1) | ||
| destr.getX().assertEquals(0.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package DialogTests | ||
| import Dialog | ||
| import Wurstunit | ||
|
|
||
| @Test function testDialog() | ||
| let dia = createDialog() | ||
| dia..addButton("text") | ||
| ..addQuitButton(true, "test") | ||
| ..display(Player(0), true) | ||
| ..clear() | ||
| ..destr() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package EffectTests | ||
| import Effect | ||
| import Wurstunit | ||
|
|
||
| @Test function testEffect() | ||
| let eff = addEffect("testPath", vec2(12,32)) | ||
|
|
||
| eff.getLocalX().assertEquals(12.) | ||
| eff.getLocalY().assertEquals(32.) | ||
|
|
||
| eff.destr() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package PlayerTests | ||
| import Player | ||
| import Wurstunit | ||
|
|
||
| @Test function testPlayer() | ||
| let p = Player(0) | ||
| assertTrue(p == Player(0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package PlayercolorTests | ||
| import Playercolor | ||
| import Wurstunit | ||
|
|
||
| @Test public function testToInt() | ||
| PLAYER_COLOR_RED.toInt().assertEquals(0) | ||
| PLAYER_COLOR_PEANUT.toInt().assertEquals(23) | ||
|
|
||
| @Test public function testToPlayerColor() | ||
| assertTrue((0).toPlayerColor() == PLAYER_COLOR_RED) | ||
| assertTrue((23).toPlayerColor() == PLAYER_COLOR_PEANUT) | ||
|
|
||
| @Test public function testGetPlayer() | ||
| assertTrue(PLAYER_COLOR_RED.getPlayer() == Player(0)) | ||
| assertTrue(PLAYER_COLOR_PEANUT.getPlayer() == Player(23)) | ||
|
|
||
| @Test public function testGetPlayers() | ||
| // Test some Player package methods that this file depends on | ||
| (players[0] != null).assertTrue() | ||
| players[0].setColor(PLAYER_COLOR_RED) | ||
| (players[0].getColor() == PLAYER_COLOR_RED).assertTrue() | ||
| // Test getting forces of players. | ||
| let force1 = PLAYER_COLOR_RED.getPlayers() | ||
| force1.containsPlayer(Player(0)).assertTrue() | ||
| players[1].setColor(PLAYER_COLOR_BLUE) | ||
| players[2].setColor(PLAYER_COLOR_BLUE) | ||
| let force2 = PLAYER_COLOR_BLUE.getPlayers() | ||
| force2.containsPlayer(Player(1)).assertTrue() | ||
| force2.containsPlayer(Player(2)).assertTrue() | ||
| force2.containsPlayer(Player(3)).assertFalse() | ||
|
|
||
| let p = players[5] | ||
| assertTrue(p.getColor() == null) | ||
| p.setColor(PLAYER_COLOR_AQUA) | ||
| assertTrue(p.getColor() == PLAYER_COLOR_AQUA) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package RectTests | ||
| import Rect | ||
| import Wurstunit | ||
|
|
||
|
|
||
| @Test | ||
| function rectTest() | ||
| let rekt = Rect(2, 2, 4, 4) | ||
|
|
||
| rekt.width().assertEquals(2) | ||
| rekt.height().assertEquals(2) | ||
|
|
||
| rekt.getCenterX().assertEquals(3) | ||
| rekt.getCenterY().assertEquals(3) | ||
|
|
||
| rekt.moveTo(1, 1) | ||
|
|
||
| rekt.width().assertEquals(2) | ||
| rekt.height().assertEquals(2) | ||
|
|
||
| rekt.getCenterX().assertEquals(1) | ||
| rekt.getCenterY().assertEquals(1) | ||
|
|
||
| rekt.resize(ZERO2, vec2(4, 4)) | ||
|
|
||
| rekt.getCenterX().assertEquals(2) | ||
| rekt.getCenterY().assertEquals(2) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package ClosureTimersTests | ||
| import ClosureTimers | ||
| import Wurstunit | ||
|
|
||
| var x = 200 | ||
|
|
||
| @Test function testDoAfter() | ||
| doAfter(0.1) -> | ||
| x += 50 | ||
| doAfter(0.2) -> | ||
| x *= 2 | ||
| doAfter(0.3) -> | ||
| x = x div 2 | ||
| x.assertEquals(250) | ||
|
|
||
| var _count = 3 | ||
| let cb = doPeriodicallyCounted(3, 3) (CallbackCounted cb) -> | ||
| cb.getCount().assertEquals(_count) | ||
| if cb.isLast() | ||
| cb.progress().assertEquals(1, 0.0001) | ||
| cb.getCount().assertEquals(1) | ||
| else if _count == 3 | ||
| cb.progress().assertEquals(0.33333, 0.00001) | ||
| cb.getCount().assertEquals(3) | ||
| else if _count == 2 | ||
| cb.progress().assertEquals(0.66666, 0.00001) | ||
| cb.getCount().assertEquals(2) | ||
| _count-- | ||
| cb.progress().assertEquals(0, 0.00001) | ||
| cb.getCount().assertEquals(_count) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.