The first function in the plugin must return a pointer to the plugin_table.
[AROS.git] / test / clib / sscanf.c
blobf8d77c903bf2e94cefefccd028b88ff79bb11f86
1 #include <stdio.h>
2 #include <string.h>
4 #include "test.h"
6 int main(void)
8 char s[10];
9 static char text1[] = "1.3 1 string";
10 static char text2[] = "NO_NUMBERS_TEXT";
11 static char text3[] = "FSOMETHING";
12 static char text4[] = "0xAF"; /* Hex integer */
13 static char text5[] = "xAF"; /* "Hex integer" without 0 */
14 static char text6[] = "AF"; /* "Hex integer" without 0x */
15 int i, cnt;
16 float f;
18 cnt = sscanf(text1, "%f %d %s", &f, &i, s);
19 TEST(cnt == 3);
20 TEST(f == 1.3f);
21 TEST(i == 1);
22 TEST(strcmp(s, "string") == 0);
24 i = 123456;
25 cnt = sscanf(text2, "%i", &i);
26 TEST(cnt == 0);
27 TEST(i == 123456);
29 i = 123456;
30 cnt = sscanf(text3, "%i", &i);
31 TEST(cnt == 0);
32 TEST(i == 123456);
34 i = 123456;
35 cnt = sscanf(text4, "%i", &i);
36 TEST(cnt == 1);
37 TEST(i == 0xAF);
39 i = 123456;
40 cnt = sscanf(text5, "%i", &i);
41 TEST(cnt == 0);
42 TEST(i == 123456);
44 i = 123456;
45 cnt = sscanf(text6, "%i", &i);
46 TEST(cnt == 0);
47 TEST(i == 123456);
50 return 0;
53 void cleanup(void) {}