diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/unit/taf.unit | |
parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip |
Converted tabs to spaces with tabconv.
Diffstat (limited to '')
-rw-r--r-- | src/unit/taf.unit | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/unit/taf.unit b/src/unit/taf.unit index 12e93c2..47605ee 100644 --- a/src/unit/taf.unit +++ b/src/unit/taf.unit | |||
@@ -15,64 +15,64 @@ | |||
15 | 15 | ||
16 | suite Taf | 16 | suite Taf |
17 | { | 17 | { |
18 | test read1 | 18 | test read1 |
19 | { | 19 | { |
20 | #define FN_TMP ("/tmp/tmpXXXXXXXX") | 20 | #define FN_TMP ("/tmp/tmpXXXXXXXX") |
21 | Bu::String sFnTmp(FN_TMP); | 21 | Bu::String sFnTmp(FN_TMP); |
22 | Bu::File fOut = Bu::File::tempFile( sFnTmp ); | 22 | Bu::File fOut = Bu::File::tempFile( sFnTmp ); |
23 | const char *data = | 23 | const char *data = |
24 | "{test: name=\"Bob\"}" | 24 | "{test: name=\"Bob\"}" |
25 | ; | 25 | ; |
26 | fOut.write(data,strlen(data)); | 26 | fOut.write(data,strlen(data)); |
27 | fOut.close(); | 27 | fOut.close(); |
28 | 28 | ||
29 | Bu::File fIn(sFnTmp.getStr(), Bu::File::Read ); | 29 | Bu::File fIn(sFnTmp.getStr(), Bu::File::Read ); |
30 | Bu::TafReader tr(fIn); | 30 | Bu::TafReader tr(fIn); |
31 | 31 | ||
32 | Bu::TafGroup *tn = tr.readGroup(); | 32 | Bu::TafGroup *tn = tr.readGroup(); |
33 | unitTest( !strcmp("Bob", tn->getProperty("name").getStr()) ); | 33 | unitTest( !strcmp("Bob", tn->getProperty("name").getStr()) ); |
34 | delete tn; | 34 | delete tn; |
35 | 35 | ||
36 | unlink(sFnTmp.getStr()); | 36 | unlink(sFnTmp.getStr()); |
37 | #undef FN_TMP | 37 | #undef FN_TMP |
38 | } | 38 | } |
39 | 39 | ||
40 | test encode1 | 40 | test encode1 |
41 | { | 41 | { |
42 | Bu::MemBuf mb; | 42 | Bu::MemBuf mb; |
43 | Bu::TafWriter tw( mb ); | 43 | Bu::TafWriter tw( mb ); |
44 | 44 | ||
45 | Bu::TafGroup g("Test data"); | 45 | Bu::TafGroup g("Test data"); |
46 | Bu::String sData( 256 ); | 46 | Bu::String sData( 256 ); |
47 | for( int j = 0; j < 256; j++ ) | 47 | for( int j = 0; j < 256; j++ ) |
48 | sData[j] = (unsigned char)j; | 48 | sData[j] = (unsigned char)j; |
49 | g.addChild( new Bu::TafProperty("Encoded", sData) ); | 49 | g.addChild( new Bu::TafProperty("Encoded", sData) ); |
50 | tw.writeGroup( &g ); | 50 | tw.writeGroup( &g ); |
51 | 51 | ||
52 | static const char *cmpdata = "{\"Test data\":\n \"Encoded\"=\"" | 52 | static const char *cmpdata = "{\"Test data\":\n \"Encoded\"=\"" |
53 | "\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07" | 53 | "\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07" |
54 | "\\x08\\x09\\x0A\\x0B\\x0C\\x0D\\x0E\\x0F" | 54 | "\\x08\\x09\\x0A\\x0B\\x0C\\x0D\\x0E\\x0F" |
55 | "\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17" | 55 | "\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17" |
56 | "\\x18\\x19\\x1A\\x1B\\x1C\\x1D\\x1E\\x1F" | 56 | "\\x18\\x19\\x1A\\x1B\\x1C\\x1D\\x1E\\x1F" |
57 | " !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCD" | 57 | " !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCD" |
58 | "EFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghi" | 58 | "EFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghi" |
59 | "jklmnopqrstuvwxyz{|}~\\x7F" | 59 | "jklmnopqrstuvwxyz{|}~\\x7F" |
60 | "\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87" | 60 | "\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87" |
61 | "\\x88\\x89\\x8A\\x8B\\x8C\\x8D\\x8E\\x8F" | 61 | "\\x88\\x89\\x8A\\x8B\\x8C\\x8D\\x8E\\x8F" |
62 | "\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97" | 62 | "\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97" |
63 | "\\x98\\x99\\x9A\\x9B\\x9C\\x9D\\x9E\\x9F" | 63 | "\\x98\\x99\\x9A\\x9B\\x9C\\x9D\\x9E\\x9F" |
64 | "\\xA0\\xA1\\xA2\\xA3\\xA4\\xA5\\xA6\\xA7" | 64 | "\\xA0\\xA1\\xA2\\xA3\\xA4\\xA5\\xA6\\xA7" |
65 | "\\xA8\\xA9\\xAA\\xAB\\xAC\\xAD\\xAE\\xAF" | 65 | "\\xA8\\xA9\\xAA\\xAB\\xAC\\xAD\\xAE\\xAF" |
66 | "\\xB0\\xB1\\xB2\\xB3\\xB4\\xB5\\xB6\\xB7" | 66 | "\\xB0\\xB1\\xB2\\xB3\\xB4\\xB5\\xB6\\xB7" |
67 | "\\xB8\\xB9\\xBA\\xBB\\xBC\\xBD\\xBE\\xBF" | 67 | "\\xB8\\xB9\\xBA\\xBB\\xBC\\xBD\\xBE\\xBF" |
68 | "\\xC0\\xC1\\xC2\\xC3\\xC4\\xC5\\xC6\\xC7" | 68 | "\\xC0\\xC1\\xC2\\xC3\\xC4\\xC5\\xC6\\xC7" |
69 | "\\xC8\\xC9\\xCA\\xCB\\xCC\\xCD\\xCE\\xCF" | 69 | "\\xC8\\xC9\\xCA\\xCB\\xCC\\xCD\\xCE\\xCF" |
70 | "\\xD0\\xD1\\xD2\\xD3\\xD4\\xD5\\xD6\\xD7" | 70 | "\\xD0\\xD1\\xD2\\xD3\\xD4\\xD5\\xD6\\xD7" |
71 | "\\xD8\\xD9\\xDA\\xDB\\xDC\\xDD\\xDE\\xDF" | 71 | "\\xD8\\xD9\\xDA\\xDB\\xDC\\xDD\\xDE\\xDF" |
72 | "\\xE0\\xE1\\xE2\\xE3\\xE4\\xE5\\xE6\\xE7" | 72 | "\\xE0\\xE1\\xE2\\xE3\\xE4\\xE5\\xE6\\xE7" |
73 | "\\xE8\\xE9\\xEA\\xEB\\xEC\\xED\\xEE\\xEF" | 73 | "\\xE8\\xE9\\xEA\\xEB\\xEC\\xED\\xEE\\xEF" |
74 | "\\xF0\\xF1\\xF2\\xF3\\xF4\\xF5\\xF6\\xF7" | 74 | "\\xF0\\xF1\\xF2\\xF3\\xF4\\xF5\\xF6\\xF7" |
75 | "\\xF8\\xF9\\xFA\\xFB\\xFC\\xFD\\xFE\\xFF\"\n}\n"; | 75 | "\\xF8\\xF9\\xFA\\xFB\\xFC\\xFD\\xFE\\xFF\"\n}\n"; |
76 | unitTest( mb.getString() == cmpdata ); | 76 | unitTest( mb.getString() == cmpdata ); |
77 | mb.setPos( 0 ); | 77 | mb.setPos( 0 ); |
78 | Bu::TafReader tr( mb ); | 78 | Bu::TafReader tr( mb ); |