ObjFW  Diff

Differences From Artifact [d5b6a278de]:

To Artifact [453b60b8cb]:


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
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







-
-
+
+

-
+

-
+


-
+

-
+






-
+






-
+







#import "OFString.h"

/* TODO: Do real checks */

int
main()
{
	OFString *s1 = [OFString new: "test"];
	OFString *s2 = [[OFString alloc] init: ""];
	OFString *s1 = [OFString newWithCString: "test"];
	OFString *s2 = [OFString newWithCString: ""];
	OFString *s3;
	OFString *s4 = [OFString new];
	OFString *s4 = [OFString newWithConstCString: NULL];

	[s2 append: [OFConstString new: "123"]];
	[s2 append: [OFString newWithConstCString: "123"]];
	s3 = [s1 clone];

	[s4 setTo: (OFConstString*)s2];
	[s4 setTo: s2];

	if (![s1 compare: (OFConstString*)s3])
	if (![s1 compare: s3])
		puts("s1 and s3 match! GOOD!");
	else {
		puts("s1 and s3 don't match!");
		return 1;
	}

	if (![s2 compare: (OFConstString*)s4])
	if (![s2 compare: s4])
		puts("s2 and s4 match! GOOD!");
	else {
		puts("s1 and s3 don't match!");
		return 1;
	}

	if (!strcmp([[s1 append: (OFConstString*)s2] cString], "test123"))
	if (!strcmp([[s1 append: s2] cString], "test123"))
		puts("s1 appended with s2 is the expected string! GOOD!");
	else {
		puts("s1 appended with s2 is not the expected string!");
		return 1;
	}

	if (strlen([s1 cString]) == [s1 length] && [s1 length] == 7)