ObjFW  Diff

Differences From Artifact [cbcfa7ab84]:

To Artifact [e9fc459af1]:


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

#import "OFString.h"
#import "OFList.h"

/* TODO: Do real checks */
 
const wchar_t *strings[] = {











|
|
|







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

#define _ISOC99_SOURCE
#import <string.h>
#import <wchar.h>

#import "OFString.h"
#import "OFList.h"

/* TODO: Do real checks */
 
const wchar_t *strings[] = {
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
 
	[list addNew: [OFString newFromWideCString: strings[0]]];
	[list addNew: [OFString newFromWideCString: strings[1]]];
	[list addNew: [OFString newFromWideCString: strings[2]]];
 
	for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++)
		if (!wcscmp([(OFString*)[iter data] wideCString], strings[i]))
			printf("Element %zu is expected element. GOOD!\n", i);
		else {
			printf("Element %zu is not expected element!\n", i);
			return 1;
		}

	if (!wcscmp([(OFString*)[[list first] data] wideCString], strings[0]))
		puts("First element is expected element. GOOD!");
	else {
		puts("First element is not expected element!");
		return 1;
	}

	if (!wcscmp([(OFString*)[[list last] data] wideCString], strings[2]))
		puts("Last element is expected element. GOOD!");
	else {
		puts("Last element is not expected element!");
		return 1;
	}
 
	[list freeIncludingData];

	return 0;
}







|

|




|

|




|

|







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
 
	[list addNew: [OFString newFromWideCString: strings[0]]];
	[list addNew: [OFString newFromWideCString: strings[1]]];
	[list addNew: [OFString newFromWideCString: strings[2]]];
 
	for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++)
		if (!wcscmp([(OFString*)[iter data] wideCString], strings[i]))
			wprintf(L"Element %zu is expected element. GOOD!\n", i);
		else {
			wprintf(L"Element %zu is not expected element!\n", i);
			return 1;
		}

	if (!wcscmp([(OFString*)[[list first] data] wideCString], strings[0]))
		wprintf(L"First element is expected element. GOOD!\n");
	else {
		wprintf(L"First element is not expected element!\n");
		return 1;
	}

	if (!wcscmp([(OFString*)[[list last] data] wideCString], strings[2]))
		wprintf(L"Last element is expected element. GOOD!\n");
	else {
		wprintf(L"Last element is not expected element!\n");
		return 1;
	}
 
	[list freeIncludingData];

	return 0;
}