Overview
Comment: | Automatic tests for OFString and OFWideString. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
dd22ec2c8ed4649f33ac46bc75ea2501 |
User & Date: | js on 2008-09-14 18:26:37 |
Other Links: | manifest | tags |
Context
2008-09-14
| ||
18:35 | Automatic test for OFList. check-in: 722bb97765 user: js tags: trunk | |
18:26 | Automatic tests for OFString and OFWideString. check-in: dd22ec2c8e user: js tags: trunk | |
18:17 | Fix append for OFWideString. check-in: bcdf93590c user: js tags: trunk | |
Changes
Modified tests/OFString/OFString.m from [9258edbe28] to [38ab25865c].
︙ | ︙ | |||
15 16 17 18 19 20 21 | #import "OFString.h" /* TODO: Do real checks */ int main() { | | | | | > > > > | | > > > > | > | | > > > > | | > > > > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #import "OFString.h" /* TODO: Do real checks */ int main() { OFString *s1 = [OFString new: "test"]; OFString *s2 = [[OFString alloc] init: ""]; OFString *s3; OFString *s4 = [OFString new]; [s2 append: "123"]; s3 = [s1 clone]; [s4 setTo: [s2 cString]]; if (!strcmp([s1 cString], [s3 cString])) puts("s1 and s3 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (!strcmp([s2 cString], [s4 cString])) puts("s2 and s4 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (!strcmp([[s1 append: [s2 cString]] cString], "test123")) puts("s1 appended with s2 is the expected string! GOOD!"); else { puts("s1 appended with s2 is not the expected string!"); return 1; } if (strlen([s1 cString]) == [s1 length] && [s1 length] == 7) puts("s1 has the expected length. GOOD!"); else { puts("s1 does not have the expected length!"); return 1; } [s1 free]; [s2 free]; [s3 free]; [s4 free]; return 0; } |
Modified tests/OFWideString/OFWideString.m from [aeb6f6f145] to [19d2fc16c9].
1 2 3 4 5 6 7 8 9 10 11 | /* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ | < | | | | > > > > | | > > > > | > | | > > > > | | > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | /* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import <wchar.h> #import "OFWideString.h" /* TODO: Do real checks */ int main() { OFWideString *s1 = [OFWideString new: L"test"]; OFWideString *s2 = [[OFWideString alloc] init: L""]; OFWideString *s3; OFWideString *s4 = [OFWideString new]; [s2 append: L"123"]; s3 = [s1 clone]; [s4 setTo: [s2 wcString]]; if (!wcscmp([s1 wcString], [s3 wcString])) puts("s1 and s3 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (!wcscmp([s2 wcString], [s4 wcString])) puts("s2 and s4 match! GOOD!"); else { puts("s1 and s3 don't match!"); return 1; } if (!wcscmp([[s1 append: [s2 wcString]] wcString], L"test123")) puts("s1 appended with s2 is the expected string! GOOD!"); else { puts("s1 appended with s2 is not the expected string!"); return 1; } if (wcslen([s1 wcString]) == [s1 length] && [s1 length] == 7) puts("s1 has the expected length. GOOD!"); else { puts("s1 does not have the expected length!"); return 1; } [s1 free]; [s2 free]; [s3 free]; [s4 free]; return 0; } |