SQLite Android Bindings
Check-in [e4878173ae]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a broken test case in DatabaseUtilsTest.java.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e4878173ae4ec9214bd3af1795189c97ca9ea3c0
User & Date: dan 2017-11-28 18:16:46
Context
2018-01-22
18:59
Upgrade this project to version 3.22.0. check-in: 1dfc539feb user: dan tags: trunk
2017-11-28
18:16
Fix a broken test case in DatabaseUtilsTest.java. check-in: e4878173ae user: dan tags: trunk
17:05
Update some other files to better match stock Android. check-in: 253313a7ee user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to sqlite3/src/androidTest/java/org/sqlite/database/database_cts/DatabaseUtilsTest.java.

279
280
281
282
283
284
285

286
287




288
289
290
291
292
293
294
295
                null, null, null, null, null);
        assertNotNull(cursor);

        contentValues = new ContentValues();
        cursor.moveToNext();
        DatabaseUtils.cursorRowToContentValues(cursor, contentValues);
        assertFalse(contentValues.getAsBoolean("value"));

        cursor.moveToNext();
        DatabaseUtils.cursorRowToContentValues(cursor, contentValues);




        assertTrue(contentValues.getAsBoolean("value"));
    }

    public void testCursorStringToContentValues() {
        mDatabase.execSQL("INSERT INTO " + TABLE_NAME + " (name, age, address)" +
                " VALUES ('Mike', '20', 'LA');");
        Cursor cursor = mDatabase.query(TABLE_NAME, TEST_PROJECTION,
                null, null, null, null, null);







>


>
>
>
>
|







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
                null, null, null, null, null);
        assertNotNull(cursor);

        contentValues = new ContentValues();
        cursor.moveToNext();
        DatabaseUtils.cursorRowToContentValues(cursor, contentValues);
        assertFalse(contentValues.getAsBoolean("value"));
        assertTrue(contentValues.getAsInteger("value")==0);
        cursor.moveToNext();
        DatabaseUtils.cursorRowToContentValues(cursor, contentValues);
        assertTrue(contentValues.getAsInteger("value")==1);

        // The following does not work:
        // https://stackoverflow.com/questions/13095277/android-database-with-contentvalue-with-boolean-bug
        // assertTrue(contentValues.getAsBoolean("value"));
    }

    public void testCursorStringToContentValues() {
        mDatabase.execSQL("INSERT INTO " + TABLE_NAME + " (name, age, address)" +
                " VALUES ('Mike', '20', 'LA');");
        Cursor cursor = mDatabase.query(TABLE_NAME, TEST_PROJECTION,
                null, null, null, null, null);