Lines Matching +full:5 +full:- +full:10
4 * SPDX-License-Identifier: Apache-2.0
14 * NOT guarantee that ALL standards-defined functionality is present, nor does
50 * below (the static source string is longer than the locally-defined
55 #pragma GCC diagnostic ignored "-Wstringop-truncation"
70 * @brief Test implementation-defined constants library
85 return -1; in foobar()
145 && (INT8_C(-1) == -1) \ in ZTEST()
147 && (INT16_C(-2) == -2) \ in ZTEST()
149 && (INT32_C(-4) == -4) \ in ZTEST()
151 && (INT64_C(-8) == -8) \ in ZTEST()
153 && (INTMAX_C(-11) == -11) in ZTEST()
178 #define BUFSIZE 10
193 memset(buffer, 0, 10); in ZTEST()
194 for (i = 0; i < 10; i++) { in ZTEST()
212 (void)memset(buffer, 'b', 5); /* 5 is BUFSIZE / 2 */ in ZTEST()
213 zassert_equal(strlen(buffer), 5, "strlen failed"); in ZTEST()
216 zassert_equal(strnlen(buffer, BUFSIZE), 5, "strnlen failed"); in ZTEST()
252 __ASSERT_NO_MSG(sizeof(pattern) - 1 > BUFSIZE); in ZTEST()
259 "strncmp 10"); in ZTEST()
262 buffer[BUFSIZE - 1] = '\0'; in ZTEST()
264 "strncmp 10 with \0"); in ZTEST()
277 strcpy(buffer, "10 chars!\0"); in ZTEST()
279 zassert_str_equal(buffer, "10 chars!\0", "strcpy"); in ZTEST()
293 strncpy(buffer, "This is over 10 characters", BUFSIZE); in ZTEST()
313 strncpy(buffer, "Copy 10", BUFSIZE); in ZTEST()
320 ret = strncmp(rs, "10", 2); in ZTEST()
365 ret = memcmp(m1, m2, 5); in ZTEST()
383 return (*(int *)a - *(int *)b); in cmp_func()
389 int arr[5] = { 2, 5, 20, 50, 60 }; in ZTEST()
394 zassert_is_null(result, "bsearch -key not found"); in ZTEST()
398 zassert_not_null(result, "bsearch -key found"); in ZTEST()
409 int val = -5, value = 5; in ZTEST()
411 zassert_equal(abs(val), 5, "abs -5"); in ZTEST()
412 zassert_equal(abs(value), 5, "abs 5"); in ZTEST()
428 zassert_equal(atoi("3-4e"), 3, "atoi error"); in ZTEST()
431 zassert_equal(atoi("-1"), -1, "atoi error"); in ZTEST()
453 …"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; in ZTEST()
455 …" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~… in ZTEST()
578 zassert_equal(memcpy(mem_dest_tmp, mem_src_tmp, 10), in ZTEST()
580 zassert_equal(memcmp(mem_dest_tmp, mem_src_tmp, 10), in ZTEST()
586 mem_dest_tmp = mem_dest_byte + sizeof(uintptr_t) - 1; in ZTEST()
587 mem_src_tmp = mem_src_byte + sizeof(uintptr_t) - 1; in ZTEST()
588 zassert_equal(memcpy(mem_dest_tmp, mem_src_tmp, 10), in ZTEST()
590 zassert_equal(memcmp(mem_dest_tmp, mem_src_tmp, 10), in ZTEST()
596 mem_dest_tmp = mem_dest_byte + sizeof(uintptr_t) - 1; in ZTEST()
597 mem_src_tmp = mem_src_byte + sizeof(uintptr_t) - 1; in ZTEST()
600 zassert_not_equal(memcmp(mem_dest_tmp, mem_src_tmp, 10), in ZTEST()
621 /* verify the buffer is not overlap, then forward-copy */ in ZTEST()
637 char str1[10] = "aabbcc", ncat[10] = "ddee"; in ZTEST()
655 #pragma GCC diagnostic ignored "-Wstringop-overflow" in ZTEST()
679 * when base is 10, [-2147483648..2147483647]
681 * when base is 10,
682 * [-9,223,372,036,854,775,808..9,223,372,036,854,775,807]
690 static const char buf2[] = " -10379aegi"; in ZTEST()
691 static const char buf3[] = "-010379aegi"; in ZTEST()
699 static const char str_normal[] = "-1011 This stopped it"; in ZTEST()
706 zassert_equal(ret, -543, "strtol base = 8 failed"); in ZTEST()
707 ret = strtol(buf1, NULL, 10); in ZTEST()
708 zassert_equal(ret, 10379, "strtol base = 10 failed"); in ZTEST()
709 ret = strtol(buf2, NULL, 10); in ZTEST()
710 zassert_equal(ret, -10379, "strtol base = 10 failed"); in ZTEST()
720 zassert_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
721 ret = strtol(buf8, NULL, 10); in ZTEST()
722 zassert_not_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
723 ret = strtol(buf9, NULL, 10); in ZTEST()
724 zassert_not_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
725 ret = strtol(buf10, NULL, 10); in ZTEST()
726 zassert_not_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
728 ret = strtol(str_normal, &stop, 10); in ZTEST()
729 zassert_equal(ret, -1011, "strtol base = 10 failed"); in ZTEST()
737 char border1[] = "-9223372036854775809"; in ZTEST()
742 ret = strtol(border1, NULL, 10); in ZTEST()
743 zassert_equal(ret, LONG_MIN, "strtol base = 10 failed"); in ZTEST()
744 ret = strtol(border2, NULL, 10); in ZTEST()
745 zassert_equal(ret, LONG_MAX, "strtol base = 10 failed"); in ZTEST()
746 ret = strtol(border3, NULL, 10); in ZTEST()
747 zassert_equal(ret, 9223372036854775806, "strtol base = 10 failed"); in ZTEST()
748 ret = strtol(border4, NULL, 10); in ZTEST()
749 zassert_equal(ret, LONG_MAX, "strtol base = 10 failed"); in ZTEST()
751 char border1[] = "-2147483649"; in ZTEST()
756 ret = strtol(border1, NULL, 10); in ZTEST()
757 zassert_equal(ret, LONG_MIN, "strtol base = 10 failed"); in ZTEST()
758 ret = strtol(border2, NULL, 10); in ZTEST()
759 zassert_equal(ret, LONG_MAX, "strtol base = 10 failed"); in ZTEST()
760 ret = strtol(border3, NULL, 10); in ZTEST()
761 zassert_equal(ret, 2147483646, "strtol base = 10 failed"); in ZTEST()
762 ret = strtol(border4, NULL, 10); in ZTEST()
763 zassert_equal(ret, LONG_MAX, "strtol base = 10 failed"); in ZTEST()
777 static const char buf2[] = " -10379aegi"; in ZTEST()
778 static const char buf3[] = "-010379aegi"; in ZTEST()
786 static const char str_normal[] = "-1011 This stopped it"; in ZTEST()
793 zassert_equal(ret, -543, "strtol base = 8 failed"); in ZTEST()
794 ret = strtoul(buf1, NULL, 10); in ZTEST()
795 zassert_equal(ret, 10379, "strtol base = 10 failed"); in ZTEST()
796 ret = strtoul(buf2, NULL, 10); in ZTEST()
797 zassert_equal(ret, -10379, "strtol base = 10 failed"); in ZTEST()
807 zassert_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
808 ret = strtoul(buf8, NULL, 10); in ZTEST()
809 zassert_not_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
810 ret = strtoul(buf9, NULL, 10); in ZTEST()
811 zassert_not_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
812 ret = strtoul(buf10, NULL, 10); in ZTEST()
813 zassert_not_equal(ret, 1037, "strtol base = 10 failed"); in ZTEST()
815 ret = strtoul(str_normal, &stop, 10); in ZTEST()
816 zassert_equal(ret, -1011, "strtol base = 10 failed"); in ZTEST()
825 char border2[] = "-18446744073709551615000"; in ZTEST()
828 ret = strtoul(border1, NULL, 10); in ZTEST()
829 zassert_equal(ret, ULONG_MAX, "strtol base = 10 failed"); in ZTEST()
830 ret = strtoul(border2, NULL, 10); in ZTEST()
831 zassert_equal(ret, ULONG_MAX, "strtol base = 10 failed"); in ZTEST()
832 ret = strtoul(border3, NULL, 10); in ZTEST()
833 zassert_equal(ret, ULONG_MAX, "strtol base = 10 failed"); in ZTEST()
837 char border2[] = "-4294967295000"; in ZTEST()
840 ret = strtoul(border1, NULL, 10); in ZTEST()
841 zassert_equal(ret, ULONG_MAX, "strtol base = 10 failed"); in ZTEST()
842 ret = strtoul(border2, NULL, 10); in ZTEST()
843 zassert_equal(ret, ULONG_MAX, "strtol base = 10 failed"); in ZTEST()
844 ret = strtoul(border3, NULL, 10); in ZTEST()
845 zassert_equal(ret, ULONG_MAX, "strtol base = 10 failed"); in ZTEST()
859 static const char buf2[] = " -10379aegi"; in test_strtoll()
860 static const char buf3[] = "-010379aegi"; in test_strtoll()
868 static const char str_normal[] = "-1011 This stopped it"; in test_strtoll()
875 zassert_equal(ret, -543, "strtoll base = 8 failed"); in test_strtoll()
876 ret = strtoll(buf1, NULL, 10); in test_strtoll()
877 zassert_equal(ret, 10379, "strtoll base = 10 failed"); in test_strtoll()
878 ret = strtoll(buf2, NULL, 10); in test_strtoll()
879 zassert_equal(ret, -10379, "strtoll base = 10 failed"); in test_strtoll()
889 zassert_equal(ret, 1037, "strtoll base = 10 failed"); in test_strtoll()
890 ret = strtoll(buf8, NULL, 10); in test_strtoll()
891 zassert_not_equal(ret, 1037, "strtoll base = 10 failed"); in test_strtoll()
892 ret = strtoll(buf9, NULL, 10); in test_strtoll()
893 zassert_not_equal(ret, 1037, "strtoll base = 10 failed"); in test_strtoll()
894 ret = strtoll(buf10, NULL, 10); in test_strtoll()
895 zassert_not_equal(ret, 1037, "strtoll base = 10 failed"); in test_strtoll()
897 ret = strtoll(str_normal, &stop, 10); in test_strtoll()
898 zassert_equal(ret, -1011, "strtoll base = 10 failed"); in test_strtoll()
905 char border1[] = "-9223372036854775808"; in test_strtoll()
911 char border7[] = "-10000000000000000000000000000000000001"; in test_strtoll()
913 ret = strtoll(border1, NULL, 10); in test_strtoll()
914 zassert_equal(ret, LLONG_MIN, "strtoll base = 10 failed"); in test_strtoll()
915 ret = strtoll(border2, NULL, 10); in test_strtoll()
916 zassert_equal(ret, LLONG_MAX, "strtoll base = 10 failed"); in test_strtoll()
917 ret = strtoll(border3, NULL, 10); in test_strtoll()
918 zassert_equal(ret, 9223372036854775806, "strtoll base = 10 failed"); in test_strtoll()
919 ret = strtoll(border4, NULL, 10); in test_strtoll()
920 zassert_equal(ret, LLONG_MAX, "strtoll base = 10 failed"); in test_strtoll()
923 ret = strtoull(border6, NULL, 10); in test_strtoll()
924 zassert_equal(errno, ERANGE, "strtoull base = 10 failed, %s != %lld", border6, ret); in test_strtoll()
925 ret = strtoull(border7, NULL, 10); in test_strtoll()
926 zassert_equal(errno, ERANGE, "strtoull base = 10 failed, %s != %lld", border7, ret); in test_strtoll()
939 static const char buf2[] = " -10379aegi"; in test_strtoull()
940 static const char buf3[] = "-010379aegi"; in test_strtoull()
948 static const char str_normal[] = "-1011 This stopped it"; in test_strtoull()
955 zassert_equal(ret, -543, "strtoull base = 8 failed"); in test_strtoull()
956 ret = strtoull(buf1, NULL, 10); in test_strtoull()
957 zassert_equal(ret, 10379, "strtoull base = 10 failed"); in test_strtoull()
958 ret = strtoull(buf2, NULL, 10); in test_strtoull()
959 zassert_equal(ret, -10379, "strtoull base = 10 failed"); in test_strtoull()
969 zassert_equal(ret, 1037, "strtoull base = 10 failed"); in test_strtoull()
970 ret = strtoull(buf8, NULL, 10); in test_strtoull()
971 zassert_not_equal(ret, 1037, "strtoull base = 10 failed"); in test_strtoull()
972 ret = strtoull(buf9, NULL, 10); in test_strtoull()
973 zassert_not_equal(ret, 1037, "strtoull base = 10 failed"); in test_strtoull()
974 ret = strtoull(buf10, NULL, 10); in test_strtoull()
975 zassert_not_equal(ret, 1037, "strtoull base = 10 failed"); in test_strtoull()
977 ret = strtoull(str_normal, &stop, 10); in test_strtoull()
978 zassert_equal(ret, -1011, "strtoull base = 10 failed"); in test_strtoull()
987 char border2[] = "-18446744073709551615000"; in test_strtoull()
991 char border6[] = "-10000000000000000000000000000000000001"; in test_strtoull()
993 ret = strtoull(border1, NULL, 10); in test_strtoull()
994 zassert_equal(ret, ULLONG_MAX, "strtoull base = 10 failed"); in test_strtoull()
995 ret = strtoull(border2, NULL, 10); in test_strtoull()
996 zassert_equal(ret, ULLONG_MAX, "strtoull base = 10 failed"); in test_strtoull()
997 ret = strtoull(border3, NULL, 10); in test_strtoull()
998 zassert_equal(ret, ULLONG_MAX, "strtoull base = 10 failed"); in test_strtoull()
1001 ret = strtoull(border5, NULL, 10); in test_strtoull()
1002 zassert_equal(errno, ERANGE, "strtoull base = 10 failed, %s != %lld", border5, ret); in test_strtoull()
1003 ret = strtoull(border6, NULL, 10); in test_strtoull()
1004 zassert_equal(errno, ERANGE, "strtoull base = 10 failed, %s != %lld", border6, ret); in test_strtoull()
1058 static const char * const tc01[] = { "1", "2", "3", "4", "5" }; in ZTEST()
1060 test_strtok_r_do("1,2,3,4,5", ",", 5, tc01, true); in ZTEST()
1061 test_strtok_r_do(",, 1 ,2 ,3 4,5 ", ", ", 5, tc01, true); in ZTEST()
1062 test_strtok_r_do("1,,,2 3,,,4 5", ", ", 5, tc01, true); in ZTEST()
1063 test_strtok_r_do("1,2 3,,,4 5 ", ", ", 5, tc01, true); in ZTEST()
1064 test_strtok_r_do("0,1,,,2 3,,,4 5", ", ", 5, tc01, false); in ZTEST()
1065 test_strtok_r_do("1,,,2 3,,,4 5", ",", 5, tc01, false); in ZTEST()
1066 test_strtok_r_do("A,,,2,3,,,4 5", ",", 5, tc01, false); in ZTEST()
1067 test_strtok_r_do("1,,,2,3,,,", ",", 5, tc01, false); in ZTEST()
1068 test_strtok_r_do("1|2|3,4|5", "| ", 5, tc01, false); in ZTEST()
1080 time_t tests2 = -5; in ZTEST()
1081 time_t tests3 = (time_t) -214748364800; in ZTEST()
1089 tp.tm_wday = -5; in ZTEST()
1103 .tm_sec = 10, /* Seconds */ in ZTEST()
1105 .tm_hour = 14, /* Hour (24-hour format) */ in ZTEST()
1106 .tm_wday = 5, /* Day of the week (0-6, 0 = Sun) */ in ZTEST()
1108 .tm_mon = 5, /* Month (0-11, January = 0) */ in ZTEST()
1109 .tm_year = 124, /* Year (current year - 1900) */ in ZTEST()
1113 zassert_equal(strncmp("Fri Jun 1 14:30:10 2024\n", buf, sizeof(buf)), 0); in ZTEST()
1116 zassert_equal(strncmp("Fri Jun 1 14:30:10 2024\n", asctime(&tp), sizeof(buf)), 0); in ZTEST()
1123 tp.tm_wday = 5; in ZTEST()
1138 time_t tests2 = -5; in ZTEST()
1139 time_t tests3 = (time_t) -214748364800; in ZTEST()
1147 tp.tm_wday = -5; in ZTEST()
1208 srand(10); in ZTEST()
1210 zassert_equal(a, 297746555, "srand with seed 10 failed"); in ZTEST()
1212 srand(UINT_MAX - 1); in ZTEST()
1214 zassert_equal(a, 2087949151, "srand with seed UINT_MAX - 1 failed"); in ZTEST()
1256 srand(10); in ZTEST()
1258 zassert_equal(a, 297746555, "srand with seed 10 failed"); in ZTEST()
1259 srand(10); in ZTEST()
1261 zassert_equal(b, 297746555, "srand with seed 10 failed (2nd)"); in ZTEST()
1262 srand(10); in ZTEST()
1264 zassert_equal(c, 297746555, "srand with seed 10 failed (3rd)"); in ZTEST()
1266 srand(UINT_MAX - 1); in ZTEST()
1268 zassert_equal(a, 2087949151, "srand with seed UINT_MAX - 1 failed"); in ZTEST()
1269 srand(UINT_MAX - 1); in ZTEST()
1271 zassert_equal(b, 2087949151, "srand with seed UINT_MAX - 1 failed (2nd)"); in ZTEST()
1272 srand(UINT_MAX - 1); in ZTEST()
1274 zassert_equal(c, 2087949151, "srand with seed UINT_MAX - 1 failed (3rd)"); in ZTEST()
1334 k_sleep(K_MSEC(10)); in ZTEST()