D2D Test completed
- Alvaro Signed-off-by: Immanuel Alvaro Bhirawa <u7280427@anu.edu.au>
This commit is contained in:
parent
0402735e96
commit
e259a9a982
@ -19,9 +19,9 @@ declaration: >-
|
|||||||
#
|
#
|
||||||
# Add as many "name+comment" entries as necessary
|
# Add as many "name+comment" entries as necessary
|
||||||
# (or remove it altogether if you haven't collaborated with anyone)
|
# (or remove it altogether if you haven't collaborated with anyone)
|
||||||
collaboration:
|
#collaboration:
|
||||||
- name:
|
# - name:
|
||||||
comment: >-
|
# comment: >-
|
||||||
|
|
||||||
# Use this to list any code that you used that you did not write,
|
# Use this to list any code that you used that you did not write,
|
||||||
# aside from code provided by the lecturer. Provide a comment
|
# aside from code provided by the lecturer. Provide a comment
|
||||||
@ -30,10 +30,10 @@ collaboration:
|
|||||||
#
|
#
|
||||||
# Add as many "url+licence+comment" entries as necessary
|
# Add as many "url+licence+comment" entries as necessary
|
||||||
# (or remove it altogether if you haven't used any external code)
|
# (or remove it altogether if you haven't used any external code)
|
||||||
code:
|
#code:
|
||||||
- comment:
|
# - comment:
|
||||||
url:
|
# url:
|
||||||
licence:
|
# licence:
|
||||||
|
|
||||||
# Use this to list any assets (artwork, sound, etc) that you used.
|
# Use this to list any assets (artwork, sound, etc) that you used.
|
||||||
# Provide a comment explaining your use of that asset and the URL
|
# 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
|
# Add as many "url+licence+comment" entries as necessary
|
||||||
# (or remove it altogether if you haven't used any external assets)
|
# (or remove it altogether if you haven't used any external assets)
|
||||||
assets:
|
#assets:
|
||||||
- comment:
|
# - comment:
|
||||||
url:
|
# url:
|
||||||
licence:
|
# licence:
|
||||||
|
|
||||||
|
|
||||||
# sign *your* name and uid here
|
# sign *your* name and uid here
|
||||||
name:
|
name: Immanuel Alvaro Bhirawa
|
||||||
uid:
|
uid: u7280427
|
@ -83,6 +83,7 @@ public class BlueLagoon {
|
|||||||
// return false
|
// return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a state string which is yet to have resources distributed amongst the stone circles,
|
* 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.
|
* randomly distribute the resources and statuettes between all the stone circles.
|
||||||
|
@ -3,6 +3,8 @@ package comp1110.ass2;
|
|||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.sql.SQLOutput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used to test BlueLagoon methods/functions.
|
* This class is used to test BlueLagoon methods/functions.
|
||||||
* This was completed for Task D2D.
|
* 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");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user