annotate bindings/java/test/TestCreate.java @ 765:337e72088f76
Fix for some sample bugs
a + b ? c : d does not do what I think it does. That bug mostly masked
a thorough logic error in building the table of counts of possible sequences;
there was too much cumulativeness.
There apparently remain problems
author |
mas01cr |
date |
Thu, 02 Jun 2011 16:31:35 +0000 |
parents |
7e1fa27b67ee |
children |
|
rev |
line source |
mas01mj@725
|
1 import junit.framework.*;
|
mas01mj@725
|
2 import java.io.File;
|
mas01mj@725
|
3 import org.omras2.*;
|
mas01mj@725
|
4
|
mas01mj@725
|
5 public class TestCreate extends TestCase
|
mas01mj@725
|
6 {
|
mas01mj@725
|
7 File testDBFile;
|
mas01mj@725
|
8
|
mas01mj@725
|
9 protected void setUp()
|
mas01mj@725
|
10 {
|
mas01mj@725
|
11 testDBFile = new File("testfiles/test.adb");
|
mas01mj@725
|
12 if(testDBFile.exists())
|
mas01mj@725
|
13 testDBFile.delete();
|
mas01mj@725
|
14 }
|
mas01mj@725
|
15
|
mas01mj@725
|
16 public void testCreateNew()
|
mas01mj@725
|
17 {
|
mas01mj@725
|
18 AudioDB testDB = new AudioDB(testDBFile);
|
mas01mj@725
|
19 assertTrue("DB created", testDB.create(5, 5, 12));
|
mas01mj@725
|
20 assertTrue("Test DB created on FS", testDBFile.exists());
|
mas01mj@725
|
21 assertTrue("Test DB has length > 0", testDBFile.length() > 0);
|
mas01mj@725
|
22 }
|
mas01mj@725
|
23
|
mas01mj@725
|
24 public void testReplaceExisting()
|
mas01mj@725
|
25 {
|
mas01mj@725
|
26 AudioDB testDB = new AudioDB(testDBFile);
|
mas01mj@725
|
27 assertTrue("DB created", testDB.create(5, 5, 12));
|
mas01mj@725
|
28
|
mas01mj@725
|
29 // Try to create again
|
mas01mj@725
|
30 testDB = new AudioDB(testDBFile);
|
mas01mj@725
|
31 assertFalse("DB not created", testDB.create(5, 5, 12));
|
mas01mj@725
|
32 assertTrue("Test DB still exists on FS", testDBFile.exists());
|
mas01mj@725
|
33 assertTrue("Test DB still has length > 0", testDBFile.length() > 0);
|
mas01mj@725
|
34 }
|
mas01mj@725
|
35 }
|