Mercurial > hg > audiodb
comparison bindings/java/test/TestInsert.java @ 725:7e1fa27b67ee
* Full status support
* Insert support (not fully tested)
* Unit tests for create + initial insert
author | mas01mj |
---|---|
date | Wed, 21 Jul 2010 14:27:07 +0000 |
parents | |
children | 4d9e4ff0a9cd |
comparison
equal
deleted
inserted
replaced
724:11fd16e1d8b3 | 725:7e1fa27b67ee |
---|---|
1 import junit.framework.*; | |
2 import java.io.File; | |
3 import org.omras2.*; | |
4 | |
5 public class TestInsert extends TestCase | |
6 { | |
7 File testDBFile; | |
8 File testFeatureFile; | |
9 protected void setUp() | |
10 { | |
11 testDBFile = new File("testfiles/test.adb"); | |
12 testFeatureFile = new File("testfiles/testfeature"); | |
13 if(testDBFile.exists()) | |
14 testDBFile.delete(); | |
15 } | |
16 | |
17 public void testInsertFile() | |
18 { | |
19 AudioDB testDB = new AudioDB(testDBFile); | |
20 assertTrue("DB created", testDB.create(1, 1, 1)); | |
21 testDB.open(AudioDB.Mode.O_RDWR); | |
22 assertTrue("Insert feature file", testDB.insert(testFeatureFile)); | |
23 Status status = testDB.getStatus(); | |
24 assertEquals("One feature in db", 1, status.getNumFiles()); | |
25 assertEquals("1D Feature", 1, status.getDim()); | |
26 System.out.println(status.hasReferences()); | |
27 System.out.println(status.isL2Normed()); | |
28 System.out.println(status.hasPower()); | |
29 System.out.println(status.hasTimes()); | |
30 } | |
31 | |
32 public void testInsertFileReadOnly() | |
33 { | |
34 AudioDB testDB = new AudioDB(testDBFile); | |
35 assertTrue("DB created", testDB.create(1, 1, 1)); | |
36 testDB.open(AudioDB.Mode.O_RDONLY); | |
37 assertFalse("Insert feature file", testDB.insert(testFeatureFile)); | |
38 } | |
39 } |