@@ -32,16 +32,22 @@ public class DroidDetectorTest {
3232
3333 private DroidDetector ddc ;
3434 private DroidDetector ddb ;
35+
36+ // For experimenting with shorter byte sequences:
37+ private long MAX_BYTES = 64 *1024 ;
3538
3639 /**
3740 * @throws java.lang.Exception
3841 */
3942 @ Before
4043 public void setUp () throws Exception {
4144 ddc = new DroidDetector ();
45+ //ddc.setMaxBytesToScan(MAX_BYTES);
46+
4247 // Another, with only binary sigs:
4348 ddb = new DroidDetector ();
4449 ddb .setBinarySignaturesOnly (true );
50+ //ddb.setMaxBytesToScan(MAX_BYTES);
4551 }
4652
4753 /**
@@ -159,6 +165,8 @@ private void printNaniteProperties(Metadata metadata) {
159165 */
160166 @ Test
161167 public void testPUIDs () throws IOException {
168+ innerTestPUIDs (ddc , "src/test/resources/random.zip" , "x-fmt/263" ,
169+ IdentificationMethod .BINARY_SIGNATURE );
162170 innerTestPUIDs (ddc , "src/test/resources/wpd/TOPOPREC.WPD" , "x-fmt/44" ,
163171 IdentificationMethod .BINARY_SIGNATURE );
164172 innerTestPUIDs (ddc , "src/test/resources/cc0.mp3" , "fmt/134" ,
@@ -170,6 +178,8 @@ public void testPUIDs() throws IOException {
170178
171179 // --- Binary sigs only:
172180
181+ innerTestPUIDs (ddc , "src/test/resources/random.zip" , "x-fmt/263" ,
182+ IdentificationMethod .BINARY_SIGNATURE );
173183 innerTestPUIDs (ddb , "src/test/resources/wpd/TOPOPREC.WPD" , "x-fmt/44" ,
174184 IdentificationMethod .BINARY_SIGNATURE );
175185 innerTestPUIDs (ddb , "src/test/resources/cc0.mp3" , "fmt/134" ,
@@ -184,6 +194,7 @@ private void innerTestPUIDs(DroidDetector dd, String testFile,
184194 String expectedPUID ,
185195 IdentificationMethod method ) throws IOException {
186196 // Get the PUID results:
197+ long start = System .currentTimeMillis ();
187198 List <ApiResultExtended > lir = dd .identify (new File (testFile ));
188199 ApiResultExtended found = null ;
189200 for (ApiResultExtended ir : lir ) {
@@ -193,6 +204,7 @@ private void innerTestPUIDs(DroidDetector dd, String testFile,
193204 if (expectedPUID .equals (ir .getPuid ()))
194205 found = ir ;
195206 }
207+ System .out .println ("That took " + (System .currentTimeMillis () - start ) + " ms" );
196208 assertNotNull ("None of the PUIDs matched " + expectedPUID , found );
197209 assertEquals (method , found .getMethod ());
198210 }
0 commit comments