END_TEST START_TEST(test_case) { const error_t expect[] = { { 13, "missing choice C in case statement" }, { 19, "missing choice B in case statement" }, { 30, "10 to 19" }, { 36, "4 to 2147483647" }, { 44, "2147483647" }, { 51, "value 50 is already covered" }, { 53, "range 60 to 64 is already covered" }, { 59, "value -1 outside STD.STANDARD.NATURAL bounds" }, { 58, "0 to 2147483647" }, { 79, "choices cover only 2 of 8 possible values" }, { 84, "expected 3 elements in aggregate but have 2" }, { 86, "expected 3 elements in aggregate but have 4" }, { 88, "expected 3 elements in string literal but have 2" }, { 90, "expected 3 elements in string literal but have 4" }, { 95, "choices do not cover all possible values" }, { 101, "choices cover only 2 of 100 possible values" }, { -1, NULL } }; expect_errors(expect); input_from_file(TESTDIR "/bounds/case.vhd"); tree_t a = parse_and_check(T_ENTITY, T_ARCH); fail_unless(sem_errors() == 0); simplify(a); bounds_check(a); fail_unless(bounds_errors() == (sizeof(expect) / sizeof(error_t)) - 1); }
extern char* subnetting_by_ip_and_subnets(const char* request) { IP_T ip; subnet_size_t subnets; Subnet num; parse_and_check(request, &ip, &subnets, &num); return SubnetCalc_subnetting_by_ip_and_subnets(ip, subnets, num); }
extern char* subnetting_by_ip_and_hosts_per_subnet(const char* request) { IP_T ip; host_size_t hosts_per_subnet; Subnet num; parse_and_check(request, &ip, &hosts_per_subnet, &num); return SubnetCalc_subnetting_by_ip_and_hosts_per_subnet( ip, hosts_per_subnet, num); }
END_TEST START_TEST(test_issue36) { input_from_file(TESTDIR "/bounds/issue36.vhd"); tree_t e = parse_and_check(T_ENTITY); fail_unless(sem_errors() == 0); simplify(e); bounds_check(e); fail_unless(bounds_errors() == 0); }
END_TEST START_TEST(test_issue200) { input_from_file(TESTDIR "/bounds/issue200.vhd"); tree_t a = parse_and_check(T_ENTITY, T_ARCH); fail_unless(sem_errors() == 0); simplify(a); bounds_check(a); fail_unless(bounds_errors() == 0); }
END_TEST START_TEST(test_issue208) { const error_t expect[] = { { 20, "case choices do not cover the following values of " }, { -1, NULL } }; expect_errors(expect); input_from_file(TESTDIR "/bounds/issue208.vhd"); tree_t a = parse_and_check(T_ENTITY, T_ARCH); fail_unless(sem_errors() == 0); simplify(a); bounds_check(a); fail_unless(bounds_errors() == ARRAY_LEN(expect) - 1); }
END_TEST START_TEST(test_issue150) { const error_t expect[] = { { 10, "expected 8 elements in aggregate but have 6" }, { -1, NULL } }; expect_errors(expect); input_from_file(TESTDIR "/bounds/issue150.vhd"); tree_t a = parse_and_check(T_ENTITY, T_ARCH); fail_unless(sem_errors() == 0); simplify(a); bounds_check(a); fail_unless(bounds_errors() == (sizeof(expect) / sizeof(error_t)) - 1); }
END_TEST START_TEST(test_issue99) { const error_t expect[] = { { 7, "type conversion argument -1.5 out of bounds 0 to 2147483647" }, { 8, "type conversion argument -1 out of bounds 1 to 5" }, { -1, NULL } }; expect_errors(expect); input_from_file(TESTDIR "/bounds/issue99.vhd"); tree_t a = parse_and_check(T_ENTITY, T_ARCH); fail_unless(sem_errors() == 0); simplify(a); bounds_check(a); fail_unless(bounds_errors() == (sizeof(expect) / sizeof(error_t)) - 1); }
END_TEST START_TEST(test_issue54) { const error_t expect[] = { { 12, "aggregate index 3 out of bounds 7 downto 4" }, { 12, "aggregate index 0 out of bounds 7 downto 4" }, { -1, NULL } }; expect_errors(expect); input_from_file(TESTDIR "/bounds/issue54.vhd"); tree_t a = parse_and_check(T_ENTITY, T_ARCH); fail_unless(sem_errors() == 0); simplify(a); bounds_check(a); fail_unless(bounds_errors() == (sizeof(expect) / sizeof(error_t)) - 1); }