From e9e2e9097eed7c217449146613fc4f0445428a96 Mon Sep 17 00:00:00 2001 From: Kevin ZHANG <36391958+GodDeath7th@users.noreply.github.com> Date: Thu, 13 Sep 2018 18:01:01 +1000 Subject: [PATCH] change --- classes/swen90006/machine/BoundaryTests.class | Bin 2590 -> 4033 bytes .../swen90006/machine/PartitioningTests.class | Bin 1823 -> 3140 bytes classes/swen90006/machine/SimpleDriver.class | Bin 2097 -> 2109 bytes src/swen90006/machine/SimpleDriver.java | 1 + test/swen90006/machine/BoundaryTests.java | 108 ++++++++++++++---- test/swen90006/machine/PartitioningTests.java | 75 +++++++++--- 6 files changed, 144 insertions(+), 40 deletions(-) diff --git a/classes/swen90006/machine/BoundaryTests.class b/classes/swen90006/machine/BoundaryTests.class index 8cc735a2d9ab7d28119bd13db1a8e979a6cfb1ed..2ba0555264cb67e19f67bce50ede5c9c692d5d05 100644 GIT binary patch literal 4033 zcmX^0Z`VEs1_l#`HCznl4DlQc30w?`3`txJ$qXs%45?fUX$<LH3>gfW><n3)4A~4h z91OW!40#OsTnrox1zZf-422vFMO+MK48`mWC0q;w4DleMl$8Mjn7J6r7|J;qDqsRk z91N8l3{@Nq)i4nj4u%>IhFT7WIu3?<m>??$Lj#P>#=+1CW3zKGG;uIAb1<}UFtl<o zv~e)Bb1-ypFm!S-ba60rb1?L9F!ZuB^szJaGcvH*Waed-*fBCNYiNcsGO#%3r=&76 z2o$9zrg-KRmlTyImt^MW6*DrZX!v9$mL=-vB<7{-2bUCO=A~O}LWD|7GIR8OGK)*B z85wwkOA?c_eG>~p5|eUL!M3EbGfZG-n8?nM#mK-JoSB}NSW;S)%E(|rgo!o~8;~uv z1KE<4Uz(SaSX3F3T3lkt$iU@Vk(^opb*W@fX<kWYZfaO&ab{9Zs$*VWen}!!PQWL> zC|y6RG%vG6AEX!EEF(q+USzY4(fB54d{Z>O85-Xljc<X*w`64CL$=S*0A0WkUBC!k zz!+V?1YN)sUBC=oz#Lt`0$l*zrAFv3H9~i(5xPr_jC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82^>J$EC#=~3r)B}dnhkMk79_0M2&ZNt!kUe7Y8ED}*#xI%5yF~HacUMNtl12w jW--E=&2efLC#=~5r)CMlnk{i^mL#m%3a4f%LYf%>5@E2f diff --git a/classes/swen90006/machine/PartitioningTests.class b/classes/swen90006/machine/PartitioningTests.class index 185cbdc5c0d85810511dafeb9e5684f17ad14be8..b084b43b945ece63ee63632a5d84c0904474e340 100644 GIT binary patch literal 3140 zcmX^0Z`VEs1_l#`DO?Qt4E`Jp0bC4$3_)BB!3-hn453^MVGQA13=s^G><m$y4ABfR z91O8s3~>zcTnrox30w@(42c{JNn8wi49V;aDO?N!4E`V@m6ZVkIJp?o7}7ZyGGGGC z91NKp3|Slu*)S0%4u%{KhFlnzor56{#%ASU$md`v;9w}^U?}2XDCS@&;b16*$+ECB zl(93EGcvH*Waed-*fBCNYiNcsGO#%3r=&762o$9zrg-KRmlTyImt^MW6*DrZX!v9$ zmL=-vB<7{-2bUCO=A~O}LWD|7GIR8OGK)*B85wwkOA?c_eG>~p5|eUL!M235GgPoM zRI)QfF*0xlXQt;RmXsEyGBQ{YVWJJh24qX^tQi^j3KEM-GC?j2Ni8lhWMtrStw>HS z00|T`GDrrM=9OgTriNt}XC~#OI_Bl&mn1^v1bp&~()F`S^D;~HL3%L^GeS4r7+t^w zUBDDwzzki$99_TyUBHr&fgjaV1{flS7$QcD3<9XSj14h`j4<?>@GuxK7&0=jhK9K5 zTCg)z@Gw*{RI@YG@G#Ue)G;y$phq=3Lp={e14AP_LlX}}GeZj_gD^q~JnY#ST6q}S z7}^;bG(7Xl5_2+B6f*M)N=p>dGILTD6*P)LX``elF*#KsEk7qGzr0wJouPw=p_8GD zhoPIHhlin;p^uS)FSQ~uw;(6ASl`vzP_LMW!I;5>kwLP!JT=eKz`(#vKQ}QsBQq~m z-xosjF!VD_U}u=f!!U_qGOBhXy<$`WV{`!%bOBRz0W)*~b94a<bOB3{06(%f3@}6t zF+{+Q6-3r$tP56!CI(iAVmjCp%9sHZ0Lvz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oH<pSY~l%QckL4US57lB3PP{ zLBJ=!C|y6RG%vG6AEezH-8>_70b_Il6LbMnbOAGT0dsT#3v>ZXMh1RVe;Hti7-EPR zF)|3C>M}OO6f(llXTrlE${@zbAdr<<mZ+bTn3t{}TvC*om(Iw*ms*jSTac4ltncb< zs8`I+;K;+^#Ndo7VWd}#DqxH*V1h1SiY{P=E?|x>V1X`R2@>E(cAx=<h#`gu*s+4h zx{P(fs?fy1>QGDvdqTOmJT=eKz`(#vKQ}QsBQq~mKLC~hGxO3xiKrMQB>j`JQj<#< z8H5pm3s0bo404#p1!sZ++@&b9EVYP{fh9LFGmnu$Oe5L{VE`m{tTn?J6d8mWL>NFo zfPoPdiwukm;tUK7f((odj0_A6tXkU{7&n6C85kKP7{nNu!P1fpEMRF~mc0y2k<3EO z!8;gOAj%{e7{HQJ4AKk?3~UUH3^EK142%r2I5o2p)+~opGaF&e@;EiK6V|MNQ!@u) z&5AfRa}w69gi|vYVa>`oHFFcztb$WB4`I!!I5qPU)~tq8Gaq5i>Nqv?6V|MOQ?meJ T&6+qh3li3>g;TQ-A<YZ`uMjz| diff --git a/classes/swen90006/machine/SimpleDriver.class b/classes/swen90006/machine/SimpleDriver.class index 5ec33d8d060b554c3f39b6814357650e46541be2..48a6bba6927d7bdb6eb1ade861cf2706744f5b38 100644 GIT binary patch delta 66 zcmdleuvcKiTQ*K-24)6U1_p-LlfSWTX0)8Virt8XWd{S#<U8zA%w`O1lYg>ni~eCS XWM?q^#lXy9%)r3F!obKN%)kHuaNQ4n delta 53 zcmdlhuu)*cTQ*K}24)6U1_p-blfSWTW;C6=irr}P19mB9JqFgvf7!Kp4H=9X7#LU> J7#V~a7yzAv3}gTR diff --git a/src/swen90006/machine/SimpleDriver.java b/src/swen90006/machine/SimpleDriver.java index dbeb3e5..bf288a4 100644 --- a/src/swen90006/machine/SimpleDriver.java +++ b/src/swen90006/machine/SimpleDriver.java @@ -45,6 +45,7 @@ public class SimpleDriver { if (m != null){ System.err.println("Number of instructions executed before exception: " + m.getCount()); } + System.exit(1); } } } diff --git a/test/swen90006/machine/BoundaryTests.java b/test/swen90006/machine/BoundaryTests.java index 36649bb..d3a53c0 100644 --- a/test/swen90006/machine/BoundaryTests.java +++ b/test/swen90006/machine/BoundaryTests.java @@ -12,96 +12,158 @@ import static org.junit.Assert.*; public class BoundaryTests { + + + private List<String> readInstructions(String file) + { + Charset charset = Charset.forName("UTF-8"); + List<String> lines = null; + try { + lines = Files.readAllLines(FileSystems.getDefault().getPath(file), charset); + } + catch (Exception e){ + System.err.println("Invalid input file! (stacktrace follows)"); + e.printStackTrace(System.err); + System.exit(1); + } + return lines; + } @Test public void boundaryTest1() throws Exception { - SimpleDriver.main(new String[]{"examples/BV1.s"}); + final List<String> lines = readInstructions("examples/BV1.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 3); } @Test public void boundaryTest2() throws Exception { - SimpleDriver.main(new String[]{"examples/BV2.s"}); + final List<String> lines = readInstructions("examples/BV2.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 2); } @Test public void boundaryTest3() throws Exception { - SimpleDriver.main(new String[]{"examples/BV3.s"}); + final List<String> lines = readInstructions("examples/BV3.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 3); } @Test public void boundaryTest4() throws Exception { - SimpleDriver.main(new String[]{"examples/BV4.s"}); + final List<String> lines = readInstructions("examples/BV4.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 3); } @Test public void boundaryTest5() throws Exception { - SimpleDriver.main(new String[]{"examples/BV5.s"}); + final List<String> lines = readInstructions("examples/BV5.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest6() throws Exception { - SimpleDriver.main(new String[]{"examples/BV6.s"}); + final List<String> lines = readInstructions("examples/BV6.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest7() throws Exception { - SimpleDriver.main(new String[]{"examples/BV7.s"}); + final List<String> lines = readInstructions("examples/BV7.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 3); } @Test public void boundaryTest8() throws Exception { - SimpleDriver.main(new String[]{"examples/BV8.s"}); + final List<String> lines = readInstructions("examples/BV8.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 3); } @Test public void boundaryTest9() throws Exception { - SimpleDriver.main(new String[]{"examples/BV9.s"}); + final List<String> lines = readInstructions("examples/BV9.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 5); } @Test public void boundaryTest10() throws Exception { - SimpleDriver.main(new String[]{"examples/BV10.s"}); + final List<String> lines = readInstructions("examples/BV10.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 6); } @Test public void boundaryTest11() throws Exception { - SimpleDriver.main(new String[]{"examples/BV11.s"}); + final List<String> lines = readInstructions("examples/BV11.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 7); } @Test public void boundaryTest12() throws Exception { - SimpleDriver.main(new String[]{"examples/BV12.s"}); + final List<String> lines = readInstructions("examples/BV12.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 5); } @Test public void boundaryTest13() throws Exception { - SimpleDriver.main(new String[]{"examples/BV13.s"}); + final List<String> lines = readInstructions("examples/BV13.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest14() throws Exception { - SimpleDriver.main(new String[]{"examples/BV14.s"}); + final List<String> lines = readInstructions("examples/BV14.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest15() throws Exception { - SimpleDriver.main(new String[]{"examples/BV15.s"}); + final List<String> lines = readInstructions("examples/BV15.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest16() throws Exception { - SimpleDriver.main(new String[]{"examples/BV16.s"}); + final List<String> lines = readInstructions("examples/BV16.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest17() throws Exception { - SimpleDriver.main(new String[]{"examples/BV17.s"}); + final List<String> lines = readInstructions("examples/BV17.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest18() throws Exception { - SimpleDriver.main(new String[]{"examples/BV18.s"}); + final List<String> lines = readInstructions("examples/BV18.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest19() throws Exception { - SimpleDriver.main(new String[]{"examples/BV19.s"}); + final List<String> lines = readInstructions("examples/BV19.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } @Test public void boundaryTest20() throws Exception { - SimpleDriver.main(new String[]{"examples/BV20.s"}); + final List<String> lines = readInstructions("examples/BV20.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 1); } @Test public void boundaryTest21() throws Exception { - SimpleDriver.main(new String[]{"examples/BV21.s"}); + final List<String> lines = readInstructions("examples/BV21.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 6); } @Test public void boundaryTest22() throws Exception { - SimpleDriver.main(new String[]{"examples/BV22.s"}); + final List<String> lines = readInstructions("examples/BV22.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 6); } @Test public void boundaryTest23() throws Exception { - SimpleDriver.main(new String[]{"examples/BV23.s"}); + final List<String> lines = readInstructions("examples/BV23.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 6); } } diff --git a/test/swen90006/machine/PartitioningTests.java b/test/swen90006/machine/PartitioningTests.java index 33c35fe..d7e2d2f 100644 --- a/test/swen90006/machine/PartitioningTests.java +++ b/test/swen90006/machine/PartitioningTests.java @@ -12,79 +12,120 @@ import static org.junit.Assert.*; public class PartitioningTests { + private List<String> readInstructions(String file){ + Charset charset = Charset.forName("UTF-8"); + List<String> lines = null; + try { + lines = Files.readAllLines(FileSystems.getDefault().getPath(file), charset); + } + catch (Exception e){ + System.err.println("Invalid input file! (stacktrace follows)"); + e.printStackTrace(System.err); + System.exit(1); + } + return lines; + } @Test public void partitionTest1() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC1.s"}); + final List<String> lines = readInstructions("examples/EC1.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 9); } @Test public void partitionTest2() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC2.s"}); + final List<String> lines = readInstructions("examples/EC2.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 3); } @Test public void partitionTest3() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC3.s"}); - + final List<String> lines = readInstructions("examples/EC3.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 3); } @Test public void partitionTest4() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC4.s"}); + final List<String> lines = readInstructions("examples/EC4.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 9); } @Test public void partitionTest5() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC5.s"}); + final List<String> lines = readInstructions("examples/EC5.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 2); } @Test public void partitionTest6() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC6.s"}); + final List<String> lines = readInstructions("examples/EC6.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 2); } @Test public void partitionTest7() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC7.s"}); + final List<String> lines = readInstructions("examples/EC7.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 7); } @Test public void partitionTest8() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC8.s"}); + final List<String> lines = readInstructions("examples/EC8.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 5); } @Test public void partitionTest9() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC9.s"}); + final List<String> lines = readInstructions("examples/EC9.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 1); } @Test public void partitionTest10() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC10.s"}); + final List<String> lines = readInstructions("examples/EC10.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 1); } @Test public void partitionTest11() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC11.s"}); - + final List<String> lines = readInstructions("examples/EC11.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 5); } @Test public void partitionTest12() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC12.s"}); + final List<String> lines = readInstructions("examples/EC12.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 5); } @Test public void partitionTest131() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC13-1.s"}); + final List<String> lines = readInstructions("examples/EC13-1.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 1); } @Test public void partitionTest132() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC13-2.s"}); + final List<String> lines = readInstructions("examples/EC13-2.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 1); } @Test public void partitionTest14() throws Exception{ - SimpleDriver.main(new String[]{"examples/EC14.s"}); + final List<String> lines = readInstructions("examples/EC14.s"); + Machine m = new Machine(); + assertEquals(m.execute(lines), 4); } } -- GitLab