aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2014-11-15 14:48:48 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2014-11-15 14:48:48 +0000
commitd50370e04a588f8d6fe02ba2ec871f356c430297 (patch)
tree3556ea675ced5edc0539ad166c0ab9712bc9f136 /src
parenta0c7c8dc6840d10fc1aa3d27881ed76434b15ecb (diff)
downloadjackcess-d50370e04a588f8d6fe02ba2ec871f356c430297.tar.gz
jackcess-d50370e04a588f8d6fe02ba2ec871f356c430297.zip
more unit tests for unicode compression
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@893 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java
index 6f101fa..93370bc 100644
--- a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java
@@ -1501,6 +1501,7 @@ public class DatabaseTest extends TestCase
for(int i = 1; i <= 0xFF; ++i) {
sb.append((char)i);
}
+ String longStr = sb.toString();
String[] expectedStrs = {
"only ascii chars",
@@ -1510,14 +1511,39 @@ public class DatabaseTest extends TestCase
"\u6F22\u5B57\u4EEE\u540D\u4EA4\u3058\u308A\u6587",
"3L9\u001D52\u0002_AB(\u00A5\u0005!!V",
"\u00FCmlaut",
- sb.toString()};
+ longStr
+ };
- for(Row row : db.getTable("Table")) {
+ Table t = db.getTable("Table");
+ for(Row row : t) {
int id = (Integer)row.get("ID");
String str = (String)row.get("Unicode");
assertEquals(expectedStrs[id-1], str);
}
+
+ ColumnImpl col = (ColumnImpl)t.getColumn("Unicode");
+
+ ByteBuffer bb = col.write(longStr, 1000);
+
+ assertEquals(longStr.length() + 2, bb.remaining());
+
+ byte[] bytes = new byte[bb.remaining()];
+ bb.get(bytes);
+ assertEquals(longStr, col.read(bytes));
+
+
+ longStr = longStr.replace('a', '\u0440');
+
+ bb = col.write(longStr, 1000);
+
+ assertEquals(longStr.length() * 2, bb.remaining());
+
+ bytes = new byte[bb.remaining()];
+ bb.get(bytes);
+ assertEquals(longStr, col.read(bytes));
+
+
db.close();
}