Added chip revision constant
[AROS.git] / test / dos / addpart.c
blobc6bdad2c3e88ad8b3a18e9a8b520987526a94da2
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 // test for AddPart(). Test cases are from Guru Book.
8 #include <proto/dos.h>
9 #include <stdio.h>
10 #include <string.h>
12 int test(STRPTR p1, CONST_STRPTR p2, CONST_STRPTR expected)
14 BOOL res;
15 char buffer[100];
16 memset(buffer, 0, sizeof(buffer));
17 strcpy(buffer, p1);
19 res = AddPart(buffer, p2, sizeof(buffer));
21 if (res == DOSFALSE)
23 printf("AddPart() returned DOSFALSE for %s %s\n", p1, p2);
24 return 1;
27 if (strcmp(buffer, expected) != 0)
29 printf("AddPart() created string %s; expected was %s\n", buffer, expected);
30 return 1;
32 return 0;
35 int main(void)
37 int error = 0;
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;