ObjFW  Check-in [2d0f01d788]

Overview
Comment:Add tests for OFNumber.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2d0f01d78867fb16467c16123a8280595da285684d67834794b7dfe252e147f9
User & Date: js on 2010-02-13 14:09:37
Other Links: manifest | tags
Context
2010-02-16
12:11
Fix a typo. check-in: cdea8f326d user: js tags: trunk
2010-02-13
14:09
Add tests for OFNumber. check-in: 2d0f01d788 user: js tags: trunk
14:07
Fix a bug in all OFNumber operations using CALCULATE2. check-in: d68c28b9de user: js tags: trunk
Changes

Modified tests/Makefile from [695657576d] to [dfcf866346].

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
include ../extra.mk

SUBDIRS = ${TESTPLUGIN}

PROG_NOINST = tests${PROG_SUFFIX}
SRCS = OFArray.m	\
       OFDataArray.m	\
       OFDictionary.m	\
       OFHashes.m	\
       OFList.m		\

       OFObject.m	\
       ${OFPLUGIN_M}	\
       OFString.m	\
       OFTCPSocket.m	\
       ${OFTHREAD_M}	\
       OFXMLElement.m	\
       OFXMLParser.m	\










>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
include ../extra.mk

SUBDIRS = ${TESTPLUGIN}

PROG_NOINST = tests${PROG_SUFFIX}
SRCS = OFArray.m	\
       OFDataArray.m	\
       OFDictionary.m	\
       OFHashes.m	\
       OFList.m		\
       OFNumber.m	\
       OFObject.m	\
       ${OFPLUGIN_M}	\
       OFString.m	\
       OFTCPSocket.m	\
       ${OFTHREAD_M}	\
       OFXMLElement.m	\
       OFXMLParser.m	\

Added tests/OFNumber.m version [15e9f25794].

























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
 * Copyright (c) 2008 - 2009
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. 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 "OFNumber.h"
#import "OFAutoreleasePool.h"

#import "main.h"

static OFString *module = @"OFNumber";

void
number_tests()
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFNumber *num;

	TEST(@"+[numberWithIntMax:]",
	    (num = [OFNumber numberWithIntMax: 123456789]))

	TEST(@"-[isEqual:]",
	    [num isEqual: [OFNumber numberWithUInt32: 123456789]])

	TEST(@"-[hash]", [num hash] == 123456789)

	TEST(@"-[asDouble]", [num asDouble] == 123456789.L)

	TEST(@"-[decrease]",
	    [[num decrease] isEqual: [OFNumber numberWithInt32: 123456788]])

	TEST(@"-[divideBy:]",
	    [[num divideBy: [OFNumber numberWithInt: 2]] asInt] == 61728394)

	[pool drain];
}

Modified tests/main.m from [6d0cbb749a] to [3b0a75cedb].

20
21
22
23
24
25
26

27
28
29
30
31
32
33
#import "OFAutoreleasePool.h"

extern void array_tests();
extern void dataarray_tests();
extern void dictionary_tests();
extern void hashes_tests();
extern void list_tests();

extern void object_tests();
#ifdef OF_PLUGINS
extern void plugin_tests();
#endif
#ifdef OF_HAVE_PROPERTIES
extern void properties_tests();
#endif







>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#import "OFAutoreleasePool.h"

extern void array_tests();
extern void dataarray_tests();
extern void dictionary_tests();
extern void hashes_tests();
extern void list_tests();
extern void number_tests();
extern void object_tests();
#ifdef OF_PLUGINS
extern void plugin_tests();
#endif
#ifdef OF_HAVE_PROPERTIES
extern void properties_tests();
#endif
105
106
107
108
109
110
111

112
113
114
115
116
117
118
	object_tests();
	hashes_tests();
	string_tests();
	dataarray_tests();
	array_tests();
	dictionary_tests();
	list_tests();

	tcpsocket_tests();
#ifdef OF_THREADS
	thread_tests();
#endif
	xmlelement_tests();
	xmlparser_tests();
#ifdef OF_PLUGINS







>







106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
	object_tests();
	hashes_tests();
	string_tests();
	dataarray_tests();
	array_tests();
	dictionary_tests();
	list_tests();
	number_tests();
	tcpsocket_tests();
#ifdef OF_THREADS
	thread_tests();
#endif
	xmlelement_tests();
	xmlparser_tests();
#ifdef OF_PLUGINS