-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #221 from UQcsse3200/Team-4---Waves
Team 4 waves
- Loading branch information
Showing
10 changed files
with
201 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
44 changes: 44 additions & 0 deletions
44
source/core/src/test/com/csse3200/game/components/tasks/waves/WaveClassTest.java
This file contains 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 |
---|---|---|
@@ -1,7 +1,51 @@ | ||
package com.csse3200.game.components.tasks.waves; | ||
|
||
|
||
import com.csse3200.game.components.tasks.waves.WaveClass; | ||
import com.csse3200.game.extensions.GameExtension; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import org.junit.jupiter.api.Disabled; | ||
|
||
@ExtendWith(GameExtension.class) | ||
@ExtendWith(MockitoExtension.class) | ||
|
||
@Disabled | ||
class WaveClassTest { | ||
|
||
HashMap<String, int[]> waveContents; | ||
WaveClass waveClass; | ||
@BeforeEach | ||
void setUp() { | ||
waveContents = new HashMap<>(); | ||
waveContents.put("Xeno", new int[]{2, 20}); | ||
waveContents.put("DodgingDragon", new int[]{3, 40}); | ||
waveContents.put("SplittingXeno", new int[]{5, 60}); | ||
waveContents.put("DeflectXeno", new int[]{7, 80}); | ||
waveClass = new WaveClass(waveContents); | ||
} | ||
|
||
@Test | ||
public void testGetMobs() { | ||
List<Tuple> enemies = waveClass.getMobs(); | ||
assertTrue(enemies.contains("Xeno") | ||
&& enemies.contains("DodgingDragon") | ||
&& enemies.contains("SplittingXeno") | ||
&& enemies.contains("DeflectXeno")); | ||
} | ||
|
||
@Test | ||
public void testGetSize() { | ||
int size = waveClass.getSize(); | ||
assertEquals(17, size); | ||
} | ||
} |
This file contains 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
1 change: 1 addition & 0 deletions
1
source/core/src/test/com/csse3200/game/entities/factories/WaveFactoryTest.java
This file contains 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
56 changes: 56 additions & 0 deletions
56
source/core/src/test/com/csse3200/game/services/WaveServiceTest.java
This file contains 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,56 @@ | ||
package com.csse3200.game.services; | ||
|
||
import com.badlogic.gdx.audio.Sound; | ||
import com.csse3200.game.areas.ForestGameArea; | ||
import com.csse3200.game.components.tasks.waves.LevelWaves; | ||
import com.csse3200.game.components.tasks.waves.WaveTask; | ||
import com.csse3200.game.extensions.GameExtension; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import com.csse3200.game.entities.EntityService; | ||
import com.csse3200.game.extensions.GameExtension; | ||
import com.csse3200.game.physics.PhysicsService; | ||
import com.csse3200.game.rendering.RenderService; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.mockito.Mockito.mock; | ||
|
||
@Disabled | ||
@ExtendWith(GameExtension.class) | ||
public class WaveServiceTest { | ||
|
||
WaveTask waveTask; | ||
ResourceService resourceService; | ||
LevelWaves level; | ||
|
||
WaveService waveService; | ||
@BeforeEach | ||
void setUp() { | ||
resourceService = ServiceLocator.getResourceService(); | ||
waveService = ServiceLocator.getWaveService(); | ||
GameTime globalTime = mock(GameTime.class); | ||
level = mock(LevelWaves.class); | ||
ServiceLocator.registerTimeSource(globalTime); | ||
waveTask = new WaveTask(); | ||
String[] sounds = waveTask.getSounds(); | ||
resourceService.getAsset(sounds[0], Sound.class); | ||
resourceService.getAsset(sounds[1], Sound.class); | ||
} | ||
|
||
@Test | ||
void shouldSetNextWaveTime() { | ||
|
||
waveTask.start(); | ||
ServiceLocator.getWaveService().setEnemyCount(0); | ||
waveTask.update(); | ||
|
||
assertTrue(ServiceLocator.getWaveService().getNextWaveTime() > 0); | ||
|
||
} | ||
|
||
} |