comparison tests.c @ 563:7cb58b683677

Fix integer overflow in the test values of 32bit ints.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Jan 2020 21:28:47 +0200
parents 22f6204c4208
children 98812eb78d8e
comparison
equal deleted inserted replaced
562:5d2c1bfc04aa 563:7cb58b683677
593 if (test_set_start("printf() integer")) 593 if (test_set_start("printf() integer"))
594 { 594 {
595 int i_vals[] = { 595 int i_vals[] = {
596 0, -0, 1, -1, 10, -10, 512, -512, -1024, 596 0, -0, 1, -1, 10, -10, 512, -512, -1024,
597 612342, -612342, 0x1fff, 0x8000000, -123456789, 597 612342, -612342, 0x1fff, 0x8000000, -123456789,
598 4294967295, -2147483648 }; 598 2147483647, -2147483648 };
599 599
600 for (i1 = 0; i1 < NCOUNT(i_vals); i1++) 600 for (i1 = 0; i1 < NCOUNT(i_vals); i1++)
601 { 601 {
602 snprintf(buf, sizeof(buf), "%d", i_vals[i1]); 602 snprintf(buf, sizeof(buf), "%d", i_vals[i1]);
603 603