ObjFW  Check-in [16f1025d5c]

Overview
Comment:Improve tests.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 16f1025d5c699fbd131734cf8ae60a1bd31ace35617c2bd217f39a18e709ac1c
User & Date: js on 2009-04-20 01:55:07
Other Links: manifest | tags
Context
2009-04-21
16:47
Throw OFAllocFailedException instead of returning nil.
This exception is quite special, look at the documentation for details.
check-in: a1a5bfb3cd user: js tags: trunk
2009-04-20
01:55
Improve tests. check-in: 16f1025d5c user: js tags: trunk
01:42
Partly revert 13945ed73147 and add testcase. check-in: 6e4eb3c2ec user: js tags: trunk
Changes

Modified tests/OFDictionary/OFDictionary.m from [18eeb7ebbc] to [4a2ea7d8a4].

1
2
3
4
5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
/*
 * 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.
 */

#import "config.h"

#import <stdio.h>


#import "OFAutoreleasePool.h"
#import "OFDictionary.h"
#import "OFConstString.h"
#import "OFString.h"

int













|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * 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.
 */

#import "config.h"

#include <stdio.h>
#include <string.h>

#import "OFAutoreleasePool.h"
#import "OFDictionary.h"
#import "OFConstString.h"
#import "OFString.h"

int
31
32
33
34
35
36
37
38




39


40


41
42

	[dict set: key1
	       to: value1];
	[dict set: key2
	       to: value2];
	[pool release];

	puts([[dict get: @"key1"] cString]);




	puts([[dict get: key2] cString]);





	return 0;
}







|
>
>
>
>
|
>
>
|
>
>


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

	[dict set: key1
	       to: value1];
	[dict set: key2
	       to: value2];
	[pool release];

	if (strcmp([[dict get: @"key1"] cString], "value1")) {
		puts("\033[K\033[1;31mTest 1/2 failed!\033[m");
		return 1;
	}

	if (strcmp([[dict get: key2] cString], "value2")) {
		puts("\033[K\033[1;31mTest 2/2 failed!\033[m");
		return 1;
	}

	puts("\033[1;32mTests successful: 2/2\033[0m");
	return 0;
}

Modified tests/OFPlugin/OFPlugin.m from [0f4331146f] to [4ca81ff021].

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
/*
 * 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.
 */

#import "config.h"



#import "OFPlugin.h"
#import "TestPlugin/TestPlugin.h"

int
main()
{
	TestPlugin *plugin;

	plugin = [OFPlugin pluginFromFile: "TestPlugin/TestPlugin"];
	[plugin test];





	return 0;
}












>
>










|
>
>
|
>
>


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
/*
 * 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.
 */

#import "config.h"

#include <stdio.h>

#import "OFPlugin.h"
#import "TestPlugin/TestPlugin.h"

int
main()
{
	TestPlugin *plugin;

	plugin = [OFPlugin pluginFromFile: "TestPlugin/TestPlugin"];
	if ([plugin test: 1234] != 2468) {
		puts("\033[K\033[1;31mTest 1/1 failed!\033[m");
		return 1;
	}

	puts("\033[1;32mTests successful: 1/1\033[0m");
	return 0;
}

Modified tests/OFPlugin/TestPlugin/TestPlugin.h from [f72593c636] to [d8aeffa07b].

8
9
10
11
12
13
14
15
16
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "OFPlugin.h"

@interface TestPlugin: OFPlugin
- (void)test;
@end







|

8
9
10
11
12
13
14
15
16
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "OFPlugin.h"

@interface TestPlugin: OFPlugin
- (int)test: (int)num;
@end

Modified tests/OFPlugin/TestPlugin/TestPlugin.m from [6f671f6355] to [616318c30f].

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
/*
 * 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 <stdio.h>

#import "TestPlugin.h"

@implementation TestPlugin
- (void)test
{
	puts("Test successfull!");
}
@end

id
init_plugin()
{
	return [TestPlugin new];
}











<
<



|

|








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
/*
 * 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.
 */



#import "TestPlugin.h"

@implementation TestPlugin
- (int)test: (int)num
{
	return num * 2;
}
@end

id
init_plugin()
{
	return [TestPlugin new];
}