static int test_find_two_input_for_and(OE oe) { CircuitVisitor cv = 0; CircuitParser cp = 0; Tokenizer tk = 0; List circuit = 0; List address_of_input_gates = 0; Map input_gates = 0; Gate g = 0; _Bool ok = 0; tk = FunCallTokenizer_New(oe); cp = CircuitParser_New(oe, tk); circuit = cp->parseSource((byte*)"AND(0,1,0)",11); cv = InputGateVisitor_New(oe); input_gates = cv->visit(circuit); AssertTrue(input_gates != 0) address_of_input_gates = input_gates->get_keys(); AssertTrue( (uint)address_of_input_gates->get_element(0) == 1 ); AssertTrue( (uint)address_of_input_gates->get_element(1) == 0 ); HashMap_destroy(&input_gates); Circuit_Destroy(oe,&circuit); SingleLinkedList_destroy(&address_of_input_gates); InputGateVisitor_Destroy(&cv); test_end: return ok; }
int unloadProperties() { int ret = -1; if (_sdf_globalPropertiesMap) { HashMap_destroy(_sdf_globalPropertiesMap); _sdf_globalPropertiesMap = NULL; plat_log_msg(21754, PLAT_LOG_CAT_PRINT_ARGS, PLAT_LOG_LEVEL_DEBUG, "unloaded properties"); ret = 0; } return (ret); }
void HasMap_test() { HashMap* m = HashMap_init(); bstring b1 = bfromcstr("1"); bstring b2 = bfromcstr("2"); bstring b3 = bfromcstr("3"); bstring b4 = bfromcstr("4"); bstring b5 = bfromcstr("5"); bstring b6 = bfromcstr("6"); bstring b7 = bfromcstr("7"); HashMap_put(m, b1, 1); HashMap_put(m, b2, 2); HashMap_put(m, b3, 3); HashMap_put(m, b4, 4); HashMap_put(m, b5, 5); HashMap_put(m, b6, 6); printf("=== HashMap exists ===\n"); printf("%d: %s\n", 1, HashMap_exists(m, b1) ? "true" : "false"); printf("%d: %s\n", 2, HashMap_exists(m, b2) ? "true" : "false"); printf("%d: %s\n", 3, HashMap_exists(m, b3) ? "true" : "false"); printf("%d: %s\n", 4, HashMap_exists(m, b4) ? "true" : "false"); printf("%d: %s\n", 5, HashMap_exists(m, b5) ? "true" : "false"); printf("%d: %s\n", 6, HashMap_exists(m, b6) ? "true" : "false"); printf("%d: %s\n", 7, HashMap_exists(m, b7) ? "true" : "false"); printf("\n=== Remove 6 ===\n"); int val = HashMap_remove(m, b6); printf("%d == %d\n", val, 6); printf("%d: %s\n", 6, HashMap_exists(m, b6) ? "true" : "false"); printf("\n=== Get 4 ===\n"); val = HashMap_get(m, b4); printf("%d == %d\n", val, 4); printf("%d: %s\n", 4, HashMap_exists(m, b4) ? "true" : "false"); HashMap_destroy(m); }