Overview
Comment: | Migration of OFDictionary tests to new testing framework. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a3bfa21725a130ddbf2bcf9d56c3882e |
User & Date: | js on 2009-09-26 13:27:12 |
Other Links: | manifest | tags |
Context
2009-09-27
| ||
11:42 | Migration of OFArray tests to new testing framework. check-in: dbb0223586 user: js tags: trunk | |
2009-09-26
| ||
13:27 | Migration of OFDictionary tests to new testing framework. check-in: a3bfa21725 user: js tags: trunk | |
2009-09-21
| ||
20:35 | A few minor Win32 fixes. check-in: 59969f5450 user: js tags: trunk | |
Changes
Modified tests/Makefile from [c768dbff65] to [ec507306f8].
1 2 3 4 | include ../extra.mk SUBDIRS = OFDataArray \ OFArray \ | < | 1 2 3 4 5 6 7 8 9 10 11 | include ../extra.mk SUBDIRS = OFDataArray \ OFArray \ OFHashes \ ${OFPLUGIN} \ OFTCPSocket \ OFThread \ OFList \ OFXMLElement \ OFXMLParser \ |
︙ | ︙ |
Deleted tests/OFDictionary/Makefile version [32272b1649].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted tests/OFDictionary/OFDictionary.m version [cdca107008].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified tests_new/Makefile from [52c127904c] to [26538f9b0c].
1 | PROG_NOINST = tests${PROG_SUFFIX} | > | | | 1 2 3 4 5 6 7 8 9 10 11 | PROG_NOINST = tests${PROG_SUFFIX} SRCS = dictionary.m \ main.m \ object.m \ string.m include ../buildsys.mk include ../extra.mk CPPFLAGS += -I../src -I.. -DSTDOUT LIBS := -L../src -lobjfw ${LIBS} |
︙ | ︙ |
Added tests_new/dictionary.m version [bfcfbd3084].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 104 105 | /* * 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" #import "OFDictionary.h" #import "OFAutoreleasePool.h" #import "OFString.h" #import "OFExceptions.h" #import "main.h" static OFString *module = @"OFDictionary"; static OFString *keys[] = { @"key1", @"key2" }; static OFString *values[] = { @"value1", @"value2" }; void dictionary_tests() { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFDictionary *dict = [OFMutableDictionary dictionary]; OFIterator *iter; of_iterator_pair_t pair[3]; OFArray *akeys, *avalues; [dict setObject: values[0] forKey: keys[0]]; [dict setObject: values[1] forKey: keys[1]]; TEST(@"-[objectForKey:]", [[dict objectForKey: keys[0]] isEqual: values[0]] && [[dict objectForKey: keys[1]] isEqual: values[1]] && [dict objectForKey: @"key3"] == nil) TEST(@"-[iterator]", (iter = [dict iterator])) pair[0] = [iter nextKeyObjectPair]; pair[1] = [iter nextKeyObjectPair]; pair[2] = [iter nextKeyObjectPair]; TEST(@"OFIterator's -[nextKeyObjectPair]", [pair[0].key isEqual: keys[0]] && [pair[0].object isEqual: values[0]] && [pair[1].key isEqual: keys[1]] && [pair[1].object isEqual: values[1]] && pair[2].key == nil && pair[2].object == nil) TEST(@"-[count]", [dict count] == 2) TEST(@"+[dictionaryWithKeysAndObjects:]", (dict = [OFDictionary dictionaryWithKeysAndObjects: @"foo", @"bar", @"baz", @"qux", nil]) && [[dict objectForKey: @"foo"] isEqual: @"bar"] && [[dict objectForKey: @"baz"] isEqual: @"qux"]) TEST(@"+[dictionaryWithObject:forKey:]", (dict = [OFDictionary dictionaryWithObject: @"bar" forKey: @"foo"]) && [[dict objectForKey: @"foo"] isEqual: @"bar"]) akeys = [OFArray arrayWithObjects: keys[0], keys[1], nil]; avalues = [OFArray arrayWithObjects: values[0], values[1], nil]; TEST(@"+[dictionaryWithObjects:forKeys:]", (dict = [OFDictionary dictionaryWithObjects: avalues forKeys: akeys]) && [[dict objectForKey: keys[0]] isEqual: values[0]] && [[dict objectForKey: keys[1]] isEqual: values[1]]) TEST(@"-[copy]", (dict = [[dict copy] autorelease]) && [[dict objectForKey: keys[0]] isEqual: values[0]] && [[dict objectForKey: keys[1]] isEqual: values[1]]) TEST(@"-[mutableCopy]", (dict = [[dict mutableCopy] autorelease]) && [[dict objectForKey: keys[0]] isEqual: values[0]] && [[dict objectForKey: keys[1]] isEqual: values[1]] && [dict setObject: @"value3" forKey: @"key3"] && [[dict objectForKey: @"key3"] isEqual: @"value3"] && [dict setObject: @"foo" forKey: keys[0]] && [[dict objectForKey: keys[0]] isEqual: @"foo"]) TEST(@"-[removeObjectForKey:]", [dict removeObjectForKey: keys[0]] && [dict objectForKey: keys[0]] == nil) [pool release]; } |
Modified tests_new/main.m from [3bad531e54] to [f044fa8a49].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <stdio.h> #endif #include <stdlib.h> #import "OFString.h" #import "OFAutoreleasePool.h" extern void object_tests(); extern void string_tests(); static int fails = 0; static void output(OFString *str, int color) | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <stdio.h> #endif #include <stdlib.h> #import "OFString.h" #import "OFAutoreleasePool.h" extern void dictionary_tests(); extern void object_tests(); extern void string_tests(); static int fails = 0; static void output(OFString *str, int color) |
︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 | } int main() { object_tests(); string_tests(); return fails; } | > | 84 85 86 87 88 89 90 91 92 93 94 | } int main() { object_tests(); string_tests(); dictionary_tests(); return fails; } |