Changeset 3bacee1 in mainline for uspace/lib/posix/test/scanf.c
- Timestamp:
- 2018-04-12T16:27:17Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3cf22f9
- Parents:
- 76d0981d
- git-author:
- Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/test/scanf.c
r76d0981d r3bacee1 49 49 */ 50 50 51 PCUT_TEST(int_decimal) { 51 PCUT_TEST(int_decimal) 52 { 52 53 int number; 53 54 int rc = sscanf("4242", "%d", &number); … … 56 57 } 57 58 58 PCUT_TEST(int_negative_decimal) { 59 PCUT_TEST(int_negative_decimal) 60 { 59 61 int number; 60 62 int rc = sscanf("-53", "%d", &number); … … 69 71 */ 70 72 71 PCUT_TEST(int_misc) { 73 PCUT_TEST(int_misc) 74 { 72 75 unsigned char uhh; 73 76 signed char shh; … … 83 86 84 87 int rc = sscanf( 85 86 87 88 "\n j tt % \t -121314 98765 aqw 0765 0x77 0xABCDEF88 -99 884", 89 " j tt %%%3hhd%1hhu%3hd %3hu%u aqw%n %lo%llx %p %li %lld", 90 &shh, &uhh, &sh, &uh, &udef, &sdef, &ul, &ull, &p, &sl, &sll); 88 91 89 92 PCUT_ASSERT_INT_EQUALS(10, rc); … … 102 105 } 103 106 104 PCUT_TEST(double_misc) { 107 PCUT_TEST(double_misc) 108 { 105 109 float f; 106 110 double d; … … 108 112 109 113 int rc = sscanf( 110 111 112 114 "\n \t\t1.0 -0x555.AP10 1234.5678e12", 115 "%f %lf %Lf", 116 &f, &d, &ld); 113 117 114 118 PCUT_ASSERT_INT_EQUALS(3, rc); … … 119 123 } 120 124 121 PCUT_TEST(str_misc) { 125 PCUT_TEST(str_misc) 126 { 122 127 char str[20]; 123 128 char *pstr; 124 129 125 130 int rc = sscanf( 126 127 128 131 "\n\n\thello world \n", 132 "%5s %ms", 133 str, &pstr); 129 134 130 135 PCUT_ASSERT_INT_EQUALS(2, rc); … … 136 141 } 137 142 138 PCUT_TEST(str_matchers) { 143 PCUT_TEST(str_matchers) 144 { 139 145 char scanset[20]; 140 146 char *pscanset; 141 147 142 148 int rc = sscanf( 143 144 145 149 "\n\n\th-e-l-l-o world-] \n", 150 " %9[-eh-o] %m[^]-]", 151 scanset, &pscanset); 146 152 147 153 PCUT_ASSERT_INT_EQUALS(2, rc); … … 153 159 } 154 160 155 PCUT_TEST(char_misc) { 161 PCUT_TEST(char_misc) 162 { 156 163 char seq[20]; 157 164 char *pseq; 158 165 159 166 int rc = sscanf( 160 161 162 167 "\n\n\thello world \n", 168 " %5c %mc", 169 seq, &pseq); 163 170 164 171 PCUT_ASSERT_INT_EQUALS(2, rc);
Note:
See TracChangeset
for help on using the changeset viewer.