]>
git.saurik.com Git - apple/boot.git/blob - i386/tests/satest.c
9ae521ad61b89f33f8c09c864aafabd89995eec1
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 /* test standalone library */
28 #define TEST_RESULT "The quick brown #5 fox did fine.\n"
29 #define TEST_FMT "The quick %s #%d fox did fine.\n"
30 #define TEST_ARGS "brown", 5
33 char *sa_rld_error_buf_addr
= error_buf
;
34 int sa_rld_error_buf_size
= 1024;
35 char progname
[] = "satest";
38 * All printing of all messages goes through this function.
45 sa_rld_error_buf_size
=- slvprintf(sa_rld_error_buf_addr
,
46 sa_rld_error_buf_size
,
50 * Print the error message and set the 'error' indication.
60 // print_architecture_banner();
62 // print("%s: ", progname);
74 printf("Testing standalone library\n");
75 printf("The following two lines should be identical:\n");
76 sprintf(buf
, TEST_FMT
, TEST_ARGS
);
79 printf("\nThe following two lines should be identical:\n");
80 error(TEST_FMT
, TEST_ARGS
);
84 printf("Comparing two strings:\n");
85 ret
= strcmp("abra","cadabra");
86 printf("%d should not be 0.\n",ret
);
88 printf("Comparing two strings:\n");
89 ret
= strcmp("abra","abra");
90 printf("%d should be 0.\n",ret
);
92 printf("Comparing two strings:\n");
93 ret
= strncmp("abcdefghij","abcdef",6);
94 printf("%d should be 0.\n",ret
);
96 printf("printf(\"Test: %% 12s\\n\",\"abb\");\n");
97 printf("Test: abb\n");
98 printf("Test: % 12s\n","abb");
100 printf("printf(\"Test: %%04d\\n\",77);\n");
101 printf("Test: 0077\n");
102 printf("Test: %04d\n",77);
104 printf("printf(\"Test: %% 2d\\n\",9);\n");
106 printf("Test: % 2d\n",9);
108 printf("printf(\"Test: %% 8d\\n\",-9);\n");
109 printf("Test: -9\n");
110 printf("Test: % 8d\n",-9);