Skip to content

Commit

Permalink
chore: update pl_ds tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Dec 11, 2024
1 parent 900d2a9 commit 3497f97
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/pl_ds_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ hashmap_test_0(void* pData)

int* sbiValues = NULL;
pl_sb_push(sbiValues, 0);
pl_sb_push(sbiValues, 69);
pl_sb_push(sbiValues, 907);
pl_hm_insert(ptHashMap, pl_hm_hash_str("Dirty Number"), pl_sb_size(sbiValues) - 1);
pl_sb_push(sbiValues, 117);
pl_hm_insert(ptHashMap, pl_hm_hash_str("Spartan Number"), pl_sb_size(sbiValues) - 1);
Expand All @@ -24,7 +24,7 @@ hashmap_test_0(void* pData)
pl_hm_insert(ptHashMap, pl_hm_hash("Spartan Number2", strlen("Spartan Number2"), i), pl_sb_size(sbiValues) - 1);
}

pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Dirty Number"))], 69, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Dirty Number"))], 907, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Spartan Number"))], 117, NULL);

pl_hm_remove(ptHashMap, pl_hm_hash_str("Dirty Number"));
Expand All @@ -35,11 +35,11 @@ hashmap_test_0(void* pData)
pl_sb_add(sbiValues);
ulFreeIndex = pl_sb_size(sbiValues) - 1;
}
sbiValues[ulFreeIndex] = 666999;
sbiValues[ulFreeIndex] = 123689;
pl_hm_insert(ptHashMap, pl_hm_hash_str("Extra dirty number"), ulFreeIndex);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Extra dirty number"))], 666999, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Extra dirty number"))], 123689, NULL);

pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Extra dirty number"))], 666999, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Extra dirty number"))], 123689, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup(ptHashMap, pl_hm_hash_str("Spartan Number"))], 117, NULL);

pl_hm_free(ptHashMap);
Expand All @@ -51,10 +51,10 @@ hashmap_test_1(void* pData)
{
plHashMap* ptHashMap = NULL;

pl_hm_insert(ptHashMap, pl_hm_hash_str("Dirty Number"), 69);
pl_hm_insert(ptHashMap, pl_hm_hash_str("Dirty Number"), 945);
pl_hm_insert(ptHashMap, pl_hm_hash_str("Spartan Number"), 117);

pl_test_expect_int_equal((int)pl_hm_lookup(ptHashMap, pl_hm_hash_str("Dirty Number")), 69, NULL);
pl_test_expect_int_equal((int)pl_hm_lookup(ptHashMap, pl_hm_hash_str("Dirty Number")), 945, NULL);
pl_test_expect_int_equal((int)pl_hm_lookup(ptHashMap, pl_hm_hash_str("Spartan Number")), 117, NULL);

pl_hm_free(ptHashMap);
Expand All @@ -67,7 +67,7 @@ hashmap_test_2(void* pData)

int* sbiValues = NULL;
pl_sb_push(sbiValues, 0);
pl_sb_push(sbiValues, 69);
pl_sb_push(sbiValues, 945);
pl_hm_insert_str(ptHashMap, "Dirty Number", pl_sb_size(sbiValues) - 1);
pl_sb_push(sbiValues, 117);
pl_hm_insert_str(ptHashMap, "Spartan Number", pl_sb_size(sbiValues) - 1);
Expand All @@ -78,7 +78,7 @@ hashmap_test_2(void* pData)
pl_hm_insert_str(ptHashMap, "Spartan Number2", pl_sb_size(sbiValues) - 1);
}

pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Dirty Number")], 69, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Dirty Number")], 945, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Spartan Number")], 117, NULL);

pl_hm_remove_str(ptHashMap, "Dirty Number");
Expand All @@ -89,11 +89,11 @@ hashmap_test_2(void* pData)
pl_sb_add(sbiValues);
ulFreeIndex = pl_sb_size(sbiValues) - 1;
}
sbiValues[ulFreeIndex] = 666999;
sbiValues[ulFreeIndex] = 945945;
pl_hm_insert_str(ptHashMap, "Extra dirty number", ulFreeIndex);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Extra dirty number")], 666999, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Extra dirty number")], 945945, NULL);

pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Extra dirty number")], 666999, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Extra dirty number")], 945945, NULL);
pl_test_expect_int_equal(sbiValues[pl_hm_lookup_str(ptHashMap, "Spartan Number")], 117, NULL);

pl_hm_free(ptHashMap);
Expand Down

0 comments on commit 3497f97

Please sign in to comment.