]>
git.saurik.com Git - apple/boot.git/blob - i386/tests/satest.c
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.1 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
24 /* 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 int printf(const char * fmt
, ...)
52 extern void putchar(int);
55 prf(fmt
, ap
, putchar
, 0);
61 * Print the error message and set the 'error' indication.
71 // print_architecture_banner();
73 // print("%s: ", progname);
81 main(int argc
, char **argv
)
86 printf("Testing standalone library\n");
87 printf("The following two lines should be identical:\n");
88 sprintf(buf
, TEST_FMT
, TEST_ARGS
);
91 printf("\nThe following two lines should be identical:\n");
92 error(TEST_FMT
, TEST_ARGS
);
96 printf("Comparing two strings:\n");
97 ret
= strcmp("abra","cadabra");
98 printf("%d should not be 0.\n",ret
);
100 printf("Comparing two strings:\n");
101 ret
= strcmp("abra","abra");
102 printf("%d should be 0.\n",ret
);
104 printf("Comparing two strings:\n");
105 ret
= strncmp("abcdefghij","abcdef",6);
106 printf("%d should be 0.\n",ret
);
108 printf("printf(\"Test: %% 12s\\n\",\"abb\");\n");
109 printf("Test: abb\n");
110 printf("Test: % 12s\n","abb");
112 printf("printf(\"Test: %%04d\\n\",77);\n");
113 printf("Test: 0077\n");
114 printf("Test: %04d\n",77);
116 printf("printf(\"Test: %% 2d\\n\",9);\n");
118 printf("Test: % 2d\n",9);
120 printf("printf(\"Test: %% 8d\\n\",-9);\n");
121 printf("Test: -9\n");
122 printf("Test: % 8d\n",-9);