Mercurial > hg > audiodb
view bindings/java/test/TestInsert.java @ 727:4d9e4ff0a9cd
* Now produces results - a Vector of Result objects
* Handles includeKeys / excludeKeys correctly
author | mas01mj |
---|---|
date | Mon, 26 Jul 2010 14:58:13 +0000 |
parents | 7e1fa27b67ee |
children | d3407d1e2f57 |
line wrap: on
line source
import junit.framework.*; import java.io.File; import org.omras2.*; public class TestInsert extends TestCase { File testDBFile; File testFeatureFile; protected void setUp() { testDBFile = new File("testfiles/test.adb"); testFeatureFile = new File("testfiles/testfeature"); if(testDBFile.exists()) testDBFile.delete(); } public void testInsertFile() { AudioDB testDB = new AudioDB(testDBFile); assertTrue("DB created", testDB.create(1, 1, 1)); testDB.open(AudioDB.Mode.O_RDWR); assertTrue("Insert feature file", testDB.insert(testFeatureFile)); Status status = testDB.getStatus(); assertEquals("One feature in db", 1, status.getNumFiles()); assertEquals("1D Feature", 1, status.getDim()); } public void testInsertFileReadOnly() { AudioDB testDB = new AudioDB(testDBFile); assertTrue("DB created", testDB.create(1, 1, 1)); testDB.open(AudioDB.Mode.O_RDONLY); assertFalse("Insert feature file", testDB.insert(testFeatureFile)); } }