Overview
Comment: | Migration of OFDataArray tests to new testing framework. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e7a372fea94b52620da8d57270223e3c |
User & Date: | js on 2009-09-30 15:01:24 |
Other Links: | manifest | tags |
Context
2009-09-30
| ||
15:43 | Migration of OFHashes tests to new testing framework. check-in: 6d6ac5a6d5 user: js tags: trunk | |
15:01 | Migration of OFDataArray tests to new testing framework. check-in: e7a372fea9 user: js tags: trunk | |
13:33 | Migration of OFXMLElement tests to new testing framework. check-in: 2437d2d0be user: js tags: trunk | |
Changes
Modified src/OFArray.m from [3bf6c09d87] to [717e5d1c5c].
︙ | ︙ | |||
227 228 229 230 231 232 233 234 | } - removeNObjects: (size_t)nobjects { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } @end | > > > > > > | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | } - removeNObjects: (size_t)nobjects { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } /* FIXME: Implement! - (uint32_t)hash { } */ @end |
Modified src/OFDictionary.m from [3ddd956ea4] to [7f0d5a8891].
︙ | ︙ | |||
277 278 279 280 281 282 283 284 | } - removeObjectForKey: (OFObject*)key { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } @end | > > > > > > | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | } - removeObjectForKey: (OFObject*)key { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } /* FIXME: Implement! - (uint32_t)hash { } */ @end |
Modified src/OFList.m from [b22035331b] to [75c1a9ff27].
︙ | ︙ | |||
226 227 228 229 230 231 232 233 | @throw e; } new->last = o; return new; } @end | > > > > > > | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | @throw e; } new->last = o; return new; } /* FIXME: Implement! - (uint32_t)hash { } */ @end |
Modified tests/Makefile from [0ad94f9883] to [e430b80025].
1 2 | include ../extra.mk | | < | 1 2 3 4 5 6 7 8 9 | include ../extra.mk SUBDIRS = OFHashes \ ${OFPLUGIN} \ OFThread \ OFXMLParser \ ${OBJC_SYNC} include ../buildsys.mk |
Deleted tests/OFDataArray/Makefile version [c0eeee4d2f].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted tests/OFDataArray/OFDataArray.m version [92c6e56e71].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified tests_new/Makefile from [98d32fa459] to [2046040715].
1 2 3 4 5 6 7 8 9 | PROG_NOINST = tests${PROG_SUFFIX} SRCS = array.m \ dictionary.m \ list.m \ main.m \ object.m \ string.m \ tcpsocket.m \ xmlelement.m | > | 1 2 3 4 5 6 7 8 9 10 | PROG_NOINST = tests${PROG_SUFFIX} SRCS = array.m \ dataarray.m \ dictionary.m \ list.m \ main.m \ object.m \ string.m \ tcpsocket.m \ xmlelement.m |
︙ | ︙ |
Modified tests_new/array.m from [765475729a] to [92fa8f95cf].
︙ | ︙ | |||
58 59 60 61 62 63 64 | [[a[2] objectAtIndex: 1] isEqual: c_ary[1]] && [[a[2] objectAtIndex: 2] isEqual: c_ary[2]]) TEST(@"-[removeNObjects:]", [a[0] removeNObjects: 2] && [a[0] count] == 1 && [[a[0] objectAtIndex: 0] isEqual: c_ary[0]]) EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", | | > > > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | [[a[2] objectAtIndex: 1] isEqual: c_ary[1]] && [[a[2] objectAtIndex: 2] isEqual: c_ary[2]]) TEST(@"-[removeNObjects:]", [a[0] removeNObjects: 2] && [a[0] count] == 1 && [[a[0] objectAtIndex: 0] isEqual: c_ary[0]]) EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", OFOutOfRangeException, [a[0] objectAtIndex: [a[0] count]]) EXPECT_EXCEPTION(@"Detect out of range in -[removeNItems:]", OFOutOfRangeException, [a[0] removeNObjects: [a[0] count] + 1]) [pool release]; } |
Added tests_new/dataarray.m version [8f9b25b225].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | /* * Copyright (c) 2008 - 2009 * 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. */ #include "config.h" #include <string.h> #import "OFArray.h" #import "OFAutoreleasePool.h" #import "OFString.h" #import "OFExceptions.h" #import "main.h" static OFString *module; const char *str = "Hello!"; static void do_tests(Class class) { OFDataArray *array[2]; void *data[2]; Class other; TEST(@"+[dataArrayWithItemSize:]", (array[0] = [class dataArrayWithItemSize: 4096])) data[0] = [array[0] allocMemoryWithSize: 4096]; data[1] = [array[0] allocMemoryWithSize: 4096]; memset(data[0], 0xFF, 4096); memset(data[1], 0x42, 4096); TEST(@"-[addItem:]", [array[0] addItem: data[0]] && [array[0] addItem: data[1]]) TEST(@"-[itemAtIndex:]", !memcmp([array[0] itemAtIndex: 0], data[0], 4096) && !memcmp([array[0] itemAtIndex: 1], data[1], 4096)) TEST(@"-[lastItem]", !memcmp([array[0] lastItem], data[1], 4096)) TEST(@"-[count]", [array[0] count] == 2) other = (class == [OFDataArray class] ? [OFBigDataArray class] : [OFDataArray class]); TEST(@"-[isEqual:]", (array[1] = [other dataArrayWithItemSize: 4096]) && [array[1] addNItems: [array[0] count] fromCArray: [array[0] data]] && [array[1] isEqual: array[0]] && [array[1] removeNItems: 1] && ![array[0] isEqual: array[1]]) TEST(@"-[copy]", (array[1] = [[array[0] copy] autorelease]) && [array[0] isEqual: array[1]]) TEST(@"-[compare]", [array[0] compare: array[1]] == 0 && [array[1] removeNItems: 1] && [array[0] compare: array[1]] == 0x42 && [array[1] compare: array[0]] == -0x42) TEST(@"-[hash]", [array[0] hash] == 0xC54621B6) TEST(@"-[removeNItems:]", [array[0] removeNItems: 1]) TEST(@"Building strings", (array[0] = [class dataArrayWithItemSize: 1]) && [array[0] addNItems: 6 fromCArray: (void*)str] && [array[0] addItem: ""] && !strcmp([array[0] data], str)) EXPECT_EXCEPTION(@"Detect out of range in -[itemAtIndex:]", OFOutOfRangeException, [array[0] itemAtIndex: [array[0] count]]) EXPECT_EXCEPTION(@"Detect out of range in -[addNItems:fromCArray:]", OFOutOfRangeException, [array[0] addNItems: SIZE_MAX fromCArray: NULL]) EXPECT_EXCEPTION(@"Detect out of range in -[removeNItems:]", OFOutOfRangeException, [array[0] removeNItems: [array[0] count] + 1]) } void dataarray_tests() { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; module = @"OFDataArray"; do_tests([OFDataArray class]); module = @"OFBigDataArray"; do_tests([OFBigDataArray class]); [pool release]; } |
Modified tests_new/main.m from [8a5fa64125] to [d8a71e2ba4].
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #endif #include <stdlib.h> #import "OFString.h" #import "OFAutoreleasePool.h" extern void array_tests(); extern void dictionary_tests(); extern void list_tests(); extern void object_tests(); extern void string_tests(); extern void tcpsocket_tests(); extern void xmlelement_tests(); | > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #endif #include <stdlib.h> #import "OFString.h" #import "OFAutoreleasePool.h" extern void array_tests(); extern void dataarray_tests(); extern void dictionary_tests(); extern void list_tests(); extern void object_tests(); extern void string_tests(); extern void tcpsocket_tests(); extern void xmlelement_tests(); |
︙ | ︙ | |||
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | } int main() { object_tests(); string_tests(); array_tests(); dictionary_tests(); list_tests(); tcpsocket_tests(); xmlelement_tests(); return fails; } | > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | } int main() { object_tests(); string_tests(); dataarray_tests(); array_tests(); dictionary_tests(); list_tests(); tcpsocket_tests(); xmlelement_tests(); return fails; } |