Skip to content

Commit c532a0d

Browse files
Expand CursorAccessTest to cover all types
1 parent a33358e commit c532a0d

File tree

7 files changed

+89
-67
lines changed

7 files changed

+89
-67
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

libs/sqlcipher.jar

0 Bytes
Binary file not shown.

libs/x86/libdatabase_sqlcipher.so

0 Bytes
Binary file not shown.

net.zetetic.sqlcipher.test.iws

Lines changed: 74 additions & 62 deletions
Large diffs are not rendered by default.

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.zetetic.ZeteticApplication;
88

99
import java.io.File;
10+
import java.util.Random;
1011

1112
public class CursorAccessTest extends SQLCipherTest {
1213

@@ -28,11 +29,18 @@ public boolean execute(SQLiteDatabase database) {
2829
results.moveToFirst();
2930
int type_a = results.getType(0);
3031
int type_b = results.getType(1);
32+
int type_c = results.getType(2);
33+
int type_d = results.getType(3);
34+
int type_e = results.getType(4);
3135

3236
results.close();
3337
db.close();
3438

35-
return (type_a == Cursor.FIELD_TYPE_STRING) && (type_b == Cursor.FIELD_TYPE_INTEGER);
39+
return type_a == Cursor.FIELD_TYPE_STRING &&
40+
type_b == Cursor.FIELD_TYPE_INTEGER &&
41+
type_c == Cursor.FIELD_TYPE_NULL &&
42+
type_d == Cursor.FIELD_TYPE_FLOAT &&
43+
type_e == Cursor.FIELD_TYPE_BLOB;
3644
}
3745

3846
@Override
@@ -48,8 +56,10 @@ public MyHelper(Context context) {
4856

4957
@Override
5058
public void onCreate(SQLiteDatabase database) {
51-
database.execSQL("create table t1(a text,b integer)");
52-
database.execSQL("insert into t1(a,b) values(?, ?)", new Object[]{"test1", 100});
59+
database.execSQL("create table t1(a text, b integer, c text, d real, e blob)");
60+
byte[] data = new byte[10];
61+
new Random().nextBytes(data);
62+
database.execSQL("insert into t1(a, b, c, d, e) values(?, ?, ?, ?, ?)", new Object[]{"test1", 100, null, 3.25, data});
5363
}
5464

5565
@Override

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ private List<SQLCipherTest> getTestsToRun(){
7373
tests.add(new RawRekeyTest());
7474
tests.add(new NestedTransactionsTest());
7575
tests.add(new UnicodeTest());
76-
//tests.add(new MultiThreadReadWriteTest());
77-
//tests.add(new ComputeKDFTest());
76+
tests.add(new MultiThreadReadWriteTest());
77+
tests.add(new ComputeKDFTest());
7878
return tests;
7979
}
8080
}

0 commit comments

Comments
 (0)