Tests: Use test macros in t_vpi_package (#4726) (#4764).

This commit is contained in:
Todd Strader 2023-12-15 12:11:51 -05:00 committed by GitHub
parent fced4d6e57
commit 668dbb25ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 17 deletions

View File

@ -79,15 +79,12 @@ int mon_check() {
while (true) { while (true) {
TestVpiHandle handle = vpi_scan(it); TestVpiHandle handle = vpi_scan(it);
if (handle == NULL) break; if (handle == NULL) break;
if (strcmp("t", vpi_get_str(vpiName, handle))) { CHECK_RESULT_CSTR("t", vpi_get_str(vpiName, handle))
return __LINE__; CHECK_RESULT_Z(found_t)
} else { found_t = true;
if (found_t) return __LINE__;
found_t = true;
}
} }
it.freed(); it.freed();
if (!found_t) return __LINE__; CHECK_RESULT_NZ(found_t);
it = vpi_iterate(vpiInstance, NULL); it = vpi_iterate(vpiInstance, NULL);
@ -100,25 +97,25 @@ int mon_check() {
const char* name = vpi_get_str(vpiName, handle); const char* name = vpi_get_str(vpiName, handle);
const char* fullname = vpi_get_str(vpiFullName, handle); const char* fullname = vpi_get_str(vpiFullName, handle);
if (!strcmp("t", name)) { if (!strcmp("t", name)) {
if (strcmp("t", fullname)) return __LINE__; CHECK_RESULT_CSTR("t", fullname)
if (found_t) return __LINE__; CHECK_RESULT_Z(found_t)
found_t = true; found_t = true;
} else if (!strcmp("somepackage", name)) { } else if (!strcmp("somepackage", name)) {
if (strcmp("somepackage::", fullname)) return __LINE__; CHECK_RESULT_CSTR("somepackage::", fullname)
if (found_somepackage) return __LINE__; CHECK_RESULT_Z(found_somepackage)
found_somepackage = true; found_somepackage = true;
} else if (!strcmp("$unit", name)) { } else if (!strcmp("$unit", name)) {
if (strcmp("$unit::", fullname)) return __LINE__; CHECK_RESULT_CSTR("$unit::", fullname)
if (found_dollar_unit) return __LINE__; CHECK_RESULT_Z(found_dollar_unit)
found_dollar_unit = true; found_dollar_unit = true;
} else { } else {
return __LINE__; CHECK_RESULT_NZ(0)
} }
} }
it.freed(); it.freed();
if (!found_t) return __LINE__; CHECK_RESULT_NZ(found_t)
if (!found_somepackage) return __LINE__; CHECK_RESULT_NZ(found_somepackage)
if (!found_dollar_unit) return __LINE__; CHECK_RESULT_NZ(found_dollar_unit)
return 0; // Ok return 0; // Ok
} }