-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZdfTestcases.java
28 lines (20 loc) · 912 Bytes
/
ZdfTestcases.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.*;
public class ZdfTestcases {
public static void main(String[] args) {
for (int i=1;i<=16;++i) {
testOn("zdf_testcases/zdf" + i + ".txt");
}
}
public static void testOn(String filename) {
System.out.println("Testing: " + filename);
StripPackingUI.TestCase testCase = StripPackingUI.readFromFile(filename);
StripPacking ffdh = new FirstFitDecreasingHeight(testCase.floatingRects, testCase.width);
ffdh.execute();
if (!ffdh.validate()) throw new UnsupportedOperationException("INVALID PACKING");
System.out.println("FFDH height: " + ffdh.height);
StripPacking sf = new SplitFit(testCase.floatingRects, testCase.width);
sf.execute();
if (!sf.validate()) throw new UnsupportedOperationException("INVALID PACKING");
System.out.println("SF height: " + sf.height);
}
}