comparison tests.c @ 404:a9152a6ee9db

Adjust tests.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 07 Mar 2016 10:13:29 +0200
parents 2c83111b0703
children 4e8f26a49e27
comparison
equal deleted inserted replaced
403:2c83111b0703 404:a9152a6ee9db
350 tprint(1, "Enabled test types are 0x%04x.\n", optFlags); 350 tprint(1, "Enabled test types are 0x%04x.\n", optFlags);
351 351
352 // 352 //
353 // Test series #1 353 // Test series #1
354 // 354 //
355 char *i_fmts[] = { "", "05", "5", ".5", "7.5", "07.5", "3", "3.2", "3", ".0", "0" }; 355 char *i_fmts[] = { "", "05", "5", ".5", "8.5", "08.5", "3", "3.2", "3", ".0", "0" };
356 char *i_mods[] = { "", "-", "+", "#", }; 356 char *i_mods[] = { "", "-", "+", "#", };
357 char *i_types[] = { "d", "u", "i", "x", "X", "o", }; 357 char *i_types[] = { "d", "u", "i", "x", "X", "o", };
358 if (test_set_start("printf() integer")) 358 if (test_set_start("printf() integer"))
359 { 359 {
360 int i_vals[] = { 0, -0, -1, 2, -2, 512, -1024, 612342, -612342, 0x1fff, 0x8000000, -123456789 }; 360 int i_vals[] = { 0, -0, -1, 2, -2, 512, -1024, 612342, -612342, 0x1fff, 0x8000000, -123456789 };
392 } 392 }
393 393
394 if (test_set_start("printf() float")) 394 if (test_set_start("printf() float"))
395 { 395 {
396 double f_vals[] = { 1, 2, 3, 2.02, 612342.234, -2.07, -612342.12, 437692.9876543219, 0x1fff, 0x8000000, 0.15625 }; 396 double f_vals[] = { 1, 2, 3, 2.02, 612342.234, -2.07, -612342.12, 437692.9876543219, 0x1fff, 0x8000000, 0.15625 };
397 char *f_fmts[] = { "%f", "%1.1f", "%7.5f", "%5f", "%-5f", "", "%-5.2f", "%07.5f" }; 397 char *f_fmts[] = { "%f", "%1.1f", "%8.5f", "%5f", "%-5f", "", "%-5.2f", "%08.5f" };
398 398
399 for (i1 = 0; i1 < NCOUNT(f_vals); i1++) 399 for (i1 = 0; i1 < NCOUNT(f_vals); i1++)
400 { 400 {
401 snprintf(buf, sizeof(buf), "%f", f_vals[i1]); 401 snprintf(buf, sizeof(buf), "%f", f_vals[i1]);
402 for (i2 = 0; i2 < NCOUNT(f_fmts); i2++) 402 for (i2 = 0; i2 < NCOUNT(f_fmts); i2++)