Skip to content

Commit 6dfe7df

Browse files
Tests for reading a long and double stored as text
1 parent 375b1ea commit 6dfe7df

File tree

8 files changed

+107
-49
lines changed

8 files changed

+107
-49
lines changed

.idea/workspace.xml

Lines changed: 80 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/armeabi-v7a/libsqlcipher.so

0 Bytes
Binary file not shown.

libs/armeabi/libsqlcipher.so

0 Bytes
Binary file not shown.

libs/sqlcipher.jar

1 Byte
Binary file not shown.

libs/x86/libsqlcipher.so

0 Bytes
Binary file not shown.

src/main/java/net/zetetic/tests/TestSuiteRunner.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ private List<SQLCipherTest> getTestsToRun(){
9494
tests.add(new MultiThreadReadWriteTest());
9595
tests.add(new VerifyUTF8EncodingForKeyTest());
9696
tests.add(new TextAsIntegerTest());
97+
tests.add(new TextAsDoubleTest());
9798
return tests;
9899
}
99100
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package net.zetetic.tests;
2+
3+
import net.sqlcipher.Cursor;
4+
import net.sqlcipher.database.SQLiteDatabase;
5+
6+
public class TextAsDoubleTest extends SQLCipherTest {
7+
@Override
8+
public boolean execute(SQLiteDatabase database) {
9+
database.execSQL("create table t1(a TEXT);");
10+
database.execSQL("insert into t1(a) values(3.14159265359);");
11+
Cursor cursor = database.rawQuery("select * from t1;", new String[]{});
12+
if(cursor != null){
13+
cursor.moveToFirst();
14+
double value = cursor.getDouble(0);
15+
return value == 3.14159265359;
16+
}
17+
return false;
18+
}
19+
20+
@Override
21+
public String getName() {
22+
return "Text As Double Test";
23+
}
24+
}

src/main/java/net/zetetic/tests/TextAsIntegerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ public class TextAsIntegerTest extends SQLCipherTest {
77
@Override
88
public boolean execute(SQLiteDatabase database) {
99
database.execSQL("create table t1(a TEXT);");
10-
database.execSQL("insert into t1(a) values(5);");
10+
database.execSQL("insert into t1(a) values(500);");
1111
Cursor cursor = database.rawQuery("select * from t1;", new String[]{});
1212
if(cursor != null){
1313
cursor.moveToFirst();
1414
int value = cursor.getInt(0);
15-
return value == 5;
15+
return value == 500;
1616
}
1717
return false;
1818
}

0 commit comments

Comments
 (0)