D2D Test completed

- Alvaro

Signed-off-by: Immanuel Alvaro Bhirawa <u7280427@anu.edu.au>
This commit is contained in:
Immanuel Alvaro Bhirawa 2023-04-22 09:49:44 +10:00
parent 0402735e96
commit e259a9a982
3 changed files with 50 additions and 13 deletions

View File

@ -19,9 +19,9 @@ declaration: >-
#
# Add as many "name+comment" entries as necessary
# (or remove it altogether if you haven't collaborated with anyone)
collaboration:
- name:
comment: >-
#collaboration:
# - name:
# comment: >-
# Use this to list any code that you used that you did not write,
# aside from code provided by the lecturer. Provide a comment
@ -30,10 +30,10 @@ collaboration:
#
# Add as many "url+licence+comment" entries as necessary
# (or remove it altogether if you haven't used any external code)
code:
- comment:
url:
licence:
#code:
# - comment:
# url:
# licence:
# Use this to list any assets (artwork, sound, etc) that you used.
# Provide a comment explaining your use of that asset and the URL
@ -41,12 +41,12 @@ code:
#
# Add as many "url+licence+comment" entries as necessary
# (or remove it altogether if you haven't used any external assets)
assets:
- comment:
url:
licence:
#assets:
# - comment:
# url:
# licence:
# sign *your* name and uid here
name:
uid:
name: Immanuel Alvaro Bhirawa
uid: u7280427

View File

@ -83,6 +83,7 @@ public class BlueLagoon {
// return false
}
/**
* Given a state string which is yet to have resources distributed amongst the stone circles,
* randomly distribute the resources and statuettes between all the stone circles.

View File

@ -3,6 +3,8 @@ package comp1110.ass2;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.sql.SQLOutput;
/**
* This class is used to test BlueLagoon methods/functions.
* This was completed for Task D2D.
@ -69,4 +71,38 @@ public class D2DTests {
*/
}
@Test
public void testIsMoveStringWellFormed(){
String moveString = "S 10,11";
Assertions.assertTrue(BlueLagoon.isMoveStringWellFormed(moveString), "The test failed because \"S 10,11\" is DEEMED an invalid move String even though it should be valid");
System.out.println("Test moveString is valid");
// updating the move string to a new one
moveString = "T 4,5";
Assertions.assertTrue(BlueLagoon.isMoveStringWellFormed(moveString), "The test failed because \"T 4,5\" is DEEMED an invalid move String even though it should be valid");
System.out.println("Test 2 passed");
moveString = "A 1,2";
Assertions.assertFalse(BlueLagoon.isMoveStringWellFormed(moveString), "The test failed \"A 1,2\" is DEEMED a valid move string even though it should be invalid because the first element is supposed to be only either `S` or `T`");
System.out.println("Test 3 passed");
moveString = "S 12";
Assertions.assertFalse(BlueLagoon.isMoveStringWellFormed(moveString), "The test failed because \"S 12\" is DEEMED a valid move string even though it should be invalid because there should be a `,` between the numbers `1` and `2` to differentiate between rows and cols");
System.out.println("Test 4 passed");
moveString = "S 1, 2";
Assertions.assertFalse(BlueLagoon.isMoveStringWellFormed(moveString), "The test failed because \"S 1, 2\" is DEEMED a valid move string even though it should be invalid because there should not be any whitespace after `,`");
System.out.println("Test 5 passed");
moveString = "T 1,2";
Assertions.assertFalse(BlueLagoon.isMoveStringWellFormed(moveString), "The test failed because \"T 1,2\" is DEEMED a valid move string even though it should be invalid because there should not be 2 whitespaces after the first element (i.e. after `T`)");
System.out.println("Test 6 passed");
moveString = "S 3 ,4";
Assertions.assertFalse(BlueLagoon.isMoveStringWellFormed(moveString), "The test failed because \"S 3,4\" is DEEMED a valid move string even though it should be invalid because there should not be a whitespace after the first number");
System.out.println("Test 7 passed");
System.out.println("All Tests passed");
}
}