Changeset aaf9789c in mainline
- Timestamp:
- 2019-02-11T23:08:42Z (6 years ago)
- Children:
- db29c34
- Parents:
- d5a89a3
- Location:
- uspace/lib/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/uuid.c
rd5a89a3 raaf9789c 67 67 uuid->b[6] = (uuid->b[6] & 0x4F) | 0x40; 68 68 uuid->b[8] = (uuid->b[8] & 0xBF) | 0xB0; 69 69 70 70 rc = EOK; 71 71 error: … … 183 183 if (str == NULL) 184 184 return ENOMEM; 185 185 186 186 const char *format = "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x"; 187 187 if (uppercase) … … 189 189 190 190 int ret = snprintf(str, size, format, uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4], uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9], uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14], uuid->b[15]); 191 191 192 192 if (ret != 36) 193 193 return EINVAL; -
uspace/lib/c/test/cap.c
rd5a89a3 raaf9789c 97 97 98 98 rc = cap_format(&cap, &str); 99 99 100 100 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 101 101 PCUT_ASSERT_STR_EQUALS(out[x + (block_size * i)], str); … … 106 106 107 107 rc = cap_format(&cap, &str); 108 108 109 109 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 110 110 PCUT_ASSERT_STR_EQUALS(out[x + (block_size * i)], str); … … 149 149 150 150 rc = cap_format(&cap, &str); 151 151 152 152 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 153 153 PCUT_ASSERT_STR_EQUALS(out[i], str); … … 158 158 159 159 rc = cap_format(&cap, &str); 160 160 161 161 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 162 162 PCUT_ASSERT_STR_EQUALS(out[i], str); … … 220 220 7777, 221 221 }; 222 222 223 223 int input_dp[] = { 224 224 0, -
uspace/lib/c/test/getopt.c
rd5a89a3 raaf9789c 52 52 53 53 ret = getopt(argc, (char *const *)argv, options); 54 55 PCUT_ASSERT_INT_EQUALS('f', ret); 56 PCUT_ASSERT_INT_EQUALS(2, optind); 57 58 ret = getopt(argc, (char *const *)argv, options); 59 54 55 PCUT_ASSERT_INT_EQUALS('f', ret); 56 PCUT_ASSERT_INT_EQUALS(2, optind); 57 58 ret = getopt(argc, (char *const *)argv, options); 59 60 60 PCUT_ASSERT_INT_EQUALS('p', ret); 61 61 PCUT_ASSERT_INT_EQUALS(4, optind); … … 142 142 optreset = 1; 143 143 opterr = 0; 144 144 145 145 ret = getopt(argc, (char *const *)argv, options); 146 146 … … 166 166 optreset = 1; 167 167 opterr = 0; 168 168 169 169 ret = getopt(argc, (char *const *)argv, options); 170 170 … … 190 190 optreset = 1; 191 191 opterr = 0; 192 192 193 193 ret = getopt(argc, (char *const *)argv, options); 194 194 … … 227 227 optreset = 1; 228 228 opterr = 0; 229 229 230 230 ret = getopt(argc, (char *const *)argv, options); 231 231 … … 233 233 PCUT_ASSERT_INT_EQUALS('f', ret); 234 234 PCUT_ASSERT_INT_EQUALS(2, optind); 235 235 236 236 ret = getopt(argc, (char *const *)argv, options); 237 237 … … 257 257 optreset = 1; 258 258 opterr = 0; 259 259 260 260 ret = getopt(argc, (char *const *)argv, options); 261 261 … … 267 267 PCUT_ASSERT_INT_EQUALS('f', ret); 268 268 PCUT_ASSERT_INT_EQUALS(3, optind); 269 269 270 270 ret = getopt(argc, (char *const *)argv, options); 271 271 PCUT_ASSERT_INT_EQUALS(-1, ret); … … 285 285 optreset = 1; 286 286 opterr = 0; 287 287 288 288 ret = getopt(argc, (char *const *)argv, options); 289 289 … … 295 295 PCUT_ASSERT_INT_EQUALS('f', ret); 296 296 PCUT_ASSERT_INT_EQUALS(1, optind); 297 297 298 298 ret = getopt(argc, (char *const *)argv, options); 299 299 PCUT_ASSERT_INT_EQUALS(-1, ret); … … 313 313 optreset = 1; 314 314 opterr = 0; 315 315 316 316 ret = getopt(argc, (char *const *)argv, options); 317 317 … … 319 319 PCUT_ASSERT_INT_EQUALS(2, optind); 320 320 PCUT_ASSERT_STR_EQUALS(" param", optarg); 321 321 322 322 ret = getopt(argc, (char *const *)argv, options); 323 323 PCUT_ASSERT_INT_EQUALS(-1, ret); … … 339 339 optreset = 1; 340 340 opterr = 0; 341 341 342 342 ret = getopt(argc, (char *const *)argv, options); 343 343 … … 371 371 optreset = 1; 372 372 opterr = 0; 373 373 374 374 ret = getopt(argc, (char *const *)argv, options); 375 375 … … 396 396 optreset = 1; 397 397 opterr = 0; 398 398 399 399 ret = getopt(argc, (char *const *)argv, options); 400 400 … … 421 421 optreset = 1; 422 422 opterr = 0; 423 423 424 424 ret = getopt(argc, (char *const *)argv, options); 425 425 … … 437 437 PCUT_ASSERT_INT_EQUALS('p', ret); 438 438 PCUT_ASSERT_INT_EQUALS(4, optind); 439 439 440 440 ret = getopt(argc, (char *const *)argv, options); 441 441 PCUT_ASSERT_INT_EQUALS(-1, ret); -
uspace/lib/c/test/gsort.c
rd5a89a3 raaf9789c 68 68 int size = 10; 69 69 int data[size]; 70 70 71 71 for (int i = 0; i < size; i++) { 72 72 data[i] = (i * 13) % 9; … … 80 80 bool ret = gsort(data, size, sizeof(int), cmp_func, NULL); 81 81 PCUT_ASSERT_TRUE(ret); 82 82 83 83 int prev = data[0]; 84 84 for (int i = 1; i < size; i++) { … … 97 97 data[i] = size - i; 98 98 } 99 99 100 100 bool ret = gsort(&data, size, sizeof(int), cmp_func, NULL); 101 101 PCUT_ASSERT_TRUE(ret); 102 102 103 103 for (int i = 0; i < size; i++) { 104 104 PCUT_ASSERT_INT_EQUALS(i + 1, data[i]); -
uspace/lib/c/test/ieee_double.c
rd5a89a3 raaf9789c 134 134 PCUT_ASSERT_FALSE(d.is_nan); 135 135 PCUT_ASSERT_FALSE(d.is_infinity); 136 136 137 137 PCUT_ASSERT_TRUE(d.is_negative); 138 138 PCUT_ASSERT_TRUE(d.is_denormal); -
uspace/lib/c/test/uuid.c
rd5a89a3 raaf9789c 53 53 return false; 54 54 } 55 55 56 56 int f = (uuid.b[8] & 0x80) || (uuid.b[8] & 0x90); 57 57 f = f || (uuid.b[8] & 0xA0) || (uuid.b[8] & 0xB0); … … 97 97 const char *endptr; 98 98 const char *uuid_in_text = "7b1abd05-456f-4661-ab62-917685069343hello world!"; 99 99 100 100 ret = uuid_parse(uuid_in_text, &uuid, &endptr); 101 101 102 102 PCUT_ASSERT_ERRNO_VAL(EOK, ret); 103 103 PCUT_ASSERT_TRUE(uuid_valid(uuid));
Note:
See TracChangeset
for help on using the changeset viewer.