@@ -163,6 +163,26 @@ void LIC0_throws_with_length_too_small() {
163163 assertThrows (IllegalArgumentException .class , () -> LIC .LIC0 (pts .length , pts , p ));
164164 }
165165
166+
167+ @ Test
168+ /*
169+ * Contract: Method throws exception due to RADIUS1 being invalid since it is negative
170+ */
171+ void testLIC1InvalidRADIUS1 () {
172+ Point [] points = new Point [] {
173+ new Point (2 , 2 ),
174+ new Point (8 , 2 ),
175+ new Point (6 , 5 )
176+ };
177+ Parameters p = new Parameters ();
178+ p .RADIUS1 = -1 ;
179+
180+ assertThrows (IllegalArgumentException .class , () -> {
181+ LIC .LIC1 (points .length , points , p );
182+ });
183+
184+ }
185+
166186 @ Test
167187 /*
168188 * Contract: LIC1 is true iff there exists 3 consecutive points that
@@ -176,13 +196,8 @@ void testLIC1() {
176196 new Point (6 , 5 )
177197 };
178198 Parameters p = new Parameters ();
179-
180- p .RADIUS1 = -1 ;
181- assertFalse (LIC .LIC1 (points .length , points , p ));
182199 p .RADIUS1 = 3 ;
183200
184- assertFalse (LIC .LIC1 (0 , new Point []{}, p ));
185-
186201 assertTrue (LIC .LIC1 (points .length , points , p ));
187202 points [0 ].x = 2.1 ;
188203 assertFalse (LIC .LIC1 (points .length , points , p ));
@@ -556,6 +571,46 @@ public void LIC6_throws_exception_with_N_PTS_bigger_than_numpoints() {
556571 assertThrows (IllegalArgumentException .class , () -> LIC .LIC6 (points2 .length , points2 , p ));
557572 }
558573
574+ @ Test
575+ public void testLIC7InvalidKPTS () {
576+ /*
577+ * Contract: Method throws exception due to K_PTS being invalid since it is sat 0
578+ */
579+ Point [] points = new Point [] {
580+ new Point (2 , 2 ),
581+ new Point (5 , 5 ),
582+ new Point (8 , 2 )
583+ };
584+
585+ Parameters p = new Parameters ();
586+ p .LENGTH1 = 1 ;
587+ p .K_PTS = 0 ;
588+
589+ assertThrows (IllegalArgumentException .class , () -> {
590+ LIC .LIC7 (points .length , points , p );
591+ });
592+ }
593+
594+ @ Test
595+ public void testLIC7InvalidLENGTH1 () {
596+ /*
597+ * Contract: Method throws exception due to LENGTH1 being invalid since it is negtive
598+ */
599+ Point [] points = new Point [] {
600+ new Point (2 , 2 ),
601+ new Point (5 , 5 ),
602+ new Point (8 , 2 )
603+ };
604+
605+ Parameters p = new Parameters ();
606+ p .LENGTH1 = -1 ;
607+ p .K_PTS = 1 ;
608+
609+ assertThrows (IllegalArgumentException .class , () -> {
610+ LIC .LIC7 (points .length , points , p );
611+ });
612+ }
613+
559614 @ Test
560615 public void testLIC7 () {
561616 /*
@@ -577,18 +632,9 @@ public void testLIC7() {
577632 new Point (-12 , 5 )
578633 };
579634
635+
580636 Parameters p = new Parameters ();
581- p .LENGTH1 = 1 ;
582- p .K_PTS = 0 ;
583- assertFalse (LIC .LIC7 (points1 .length , points1 , p ));
584637 p .K_PTS = 1 ;
585-
586- assertFalse (LIC .LIC7 (0 , new Point []{}, p ));
587-
588- p .LENGTH1 = -1 ;
589- assertFalse (LIC .LIC7 (points1 .length , points1 , p ));
590-
591-
592638 p .LENGTH1 = 5.9 ;
593639 assertTrue (LIC .LIC7 (points1 .length , points1 , p ));
594640 p .LENGTH1 = 6 ;
@@ -1181,6 +1227,110 @@ public void LIC12_false_when_LENGTH1_is_Negative() {
11811227 assertFalse (LIC .LIC12 (numPoints , points , p ));
11821228 }
11831229
1230+ @ Test
1231+ public void testLIC13InvalidAPTS () {
1232+ /*
1233+ * Contract: Method throws exception due to A_PTS being invalid since it is sat 0
1234+ */
1235+ Point [] points = new Point [] {
1236+ new Point (2 , 2 ),
1237+ new Point (99 , 99 ),
1238+ new Point (8 , 2 ),
1239+ new Point (100 , 100 ),
1240+ new Point (6 , 5 ),
1241+ new Point (101 , 101 ),
1242+ new Point (5 , 11 )
1243+ };
1244+
1245+ Parameters p = new Parameters ();
1246+ p .RADIUS1 = 3 ;
1247+ p .A_PTS = 0 ;
1248+ p .B_PTS = 1 ;
1249+ p .RADIUS2 = 1.5 ;
1250+
1251+ assertThrows (IllegalArgumentException .class , () -> {
1252+ LIC .LIC13 (points .length , points , p );
1253+ });
1254+ }
1255+
1256+ @ Test
1257+ public void testLIC13InvalidBPTS () {
1258+ /*
1259+ * Contract: Method throws exception due to B_PTS being invalid since it is sat 0
1260+ */
1261+ Point [] points = new Point [] {
1262+ new Point (2 , 2 ),
1263+ new Point (99 , 99 ),
1264+ new Point (8 , 2 ),
1265+ new Point (100 , 100 ),
1266+ new Point (6 , 5 ),
1267+ new Point (101 , 101 ),
1268+ new Point (5 , 11 )
1269+ };
1270+
1271+ Parameters p = new Parameters ();
1272+ p .RADIUS1 = 3 ;
1273+ p .A_PTS = 1 ;
1274+ p .B_PTS = 0 ;
1275+ p .RADIUS2 = 1.5 ;
1276+
1277+ assertThrows (IllegalArgumentException .class , () -> {
1278+ LIC .LIC13 (points .length , points , p );
1279+ });
1280+ }
1281+
1282+ @ Test
1283+ public void testLIC13InvalidRADIUS1 () {
1284+ /*
1285+ * Contract: Method throws exception due to RADIUS1 being invalid since it is negative
1286+ */
1287+ Point [] points = new Point [] {
1288+ new Point (2 , 2 ),
1289+ new Point (99 , 99 ),
1290+ new Point (8 , 2 ),
1291+ new Point (100 , 100 ),
1292+ new Point (6 , 5 ),
1293+ new Point (101 , 101 ),
1294+ new Point (5 , 11 )
1295+ };
1296+
1297+ Parameters p = new Parameters ();
1298+ p .RADIUS1 = -3 ;
1299+ p .A_PTS = 1 ;
1300+ p .B_PTS = 1 ;
1301+ p .RADIUS2 = 1.5 ;
1302+
1303+ assertThrows (IllegalArgumentException .class , () -> {
1304+ LIC .LIC13 (points .length , points , p );
1305+ });
1306+ }
1307+
1308+ @ Test
1309+ public void testLIC13InvalidRADIUS2 () {
1310+ /*
1311+ * Contract: Method throws exception due to RADIUS2 being invalid since it is negative
1312+ */
1313+ Point [] points = new Point [] {
1314+ new Point (2 , 2 ),
1315+ new Point (99 , 99 ),
1316+ new Point (8 , 2 ),
1317+ new Point (100 , 100 ),
1318+ new Point (6 , 5 ),
1319+ new Point (101 , 101 ),
1320+ new Point (5 , 11 )
1321+ };
1322+
1323+ Parameters p = new Parameters ();
1324+ p .RADIUS1 = 3 ;
1325+ p .A_PTS = 1 ;
1326+ p .B_PTS = 1 ;
1327+ p .RADIUS2 = -1.5 ;
1328+
1329+ assertThrows (IllegalArgumentException .class , () -> {
1330+ LIC .LIC13 (points .length , points , p );
1331+ });
1332+ }
1333+
11841334 @ Test
11851335 public void testLIC13 () {
11861336 /*
@@ -1207,29 +1357,6 @@ public void testLIC13() {
12071357 System .out .println (radius3 );
12081358
12091359 Parameters p = new Parameters ();
1210- p .RADIUS1 = -1 ;
1211- p .A_PTS = 1 ;
1212- p .B_PTS = 1 ;
1213- p .RADIUS2 = 1.5 ;
1214-
1215- assertFalse (LIC .LIC13 (points .length , points , p ));
1216- p .RADIUS1 = 3 ;
1217-
1218- p .A_PTS = 0 ;
1219- assertFalse (LIC .LIC13 (points .length , points , p ));
1220- p .A_PTS = 1 ;
1221-
1222- p .B_PTS = 0 ;
1223- assertFalse (LIC .LIC13 (points .length , points , p ));
1224- p .B_PTS = 1 ;
1225-
1226- p .RADIUS2 = -1 ;
1227- assertFalse (LIC .LIC13 (points .length , points , p ));
1228- p .RADIUS2 = 1.5 ;
1229-
1230- assertFalse (LIC .LIC13 (0 , new Point []{}, p ));
1231-
1232-
12331360 p .RADIUS1 = 3 ;
12341361 p .A_PTS = 1 ;
12351362 p .B_PTS = 1 ;
0 commit comments