2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 // test for AddPart(). Test cases are from Guru Book.
12 int test(STRPTR p1
, CONST_STRPTR p2
, CONST_STRPTR expected
)
16 memset(buffer
, 0, sizeof(buffer
));
19 res
= AddPart(buffer
, p2
, sizeof(buffer
));
23 printf("AddPart() returned DOSFALSE for %s %s\n", p1
, p2
);
27 if (strcmp(buffer
, expected
) != 0)
29 printf("AddPart() created string %s; expected was %s\n", buffer
, expected
);
39 error
+= test("foo", "bar", "foo/bar");
40 error
+= test("foo/", "bar", "foo/bar");
41 error
+= test("foo/baz", "bar", "foo/baz/bar");
42 error
+= test("foo", "bar/baz", "foo/bar/baz");
43 error
+= test("foo:", "bar", "foo:bar");
44 error
+= test("foo:", "bar:", "bar:");
45 error
+= test("foo:baz", ":bar", "foo:bar");
46 error
+= test("foo", "/bar", "foo//bar");
47 error
+= test("foo/", "/bar", "foo//bar");
49 return error
? RETURN_ERROR
: RETURN_OK
;