Skip to content

Commit

Permalink
Fix all tests by removing materialization
Browse files Browse the repository at this point in the history
Signed-off-by: gabrieldemarmiesse <gabrieldemarmiesse@gmail.com>
  • Loading branch information
gabrieldemarmiesse committed May 12, 2024
1 parent 52f7532 commit fe2adb6
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 51 deletions.
9 changes: 9 additions & 0 deletions stdlib/test/builtin/test_hash.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,16 @@ fn test_issue_31111():
_ = hash(Int(1))


def test_hash_string_struct():
var a = String("hello")
var b = String("world")
var c = String("very very very very very very long string")
assert_not_equal(hash(a), hash(b))
assert_not_equal(hash(a), hash(c))
assert_not_equal(hash(b), hash(c))

def main():
test_hash_byte_array()
test_hash_simd()
test_issue_31111()
test_hash_string_struct()
51 changes: 22 additions & 29 deletions stdlib/test/collections/test_dict.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -393,34 +393,6 @@ fn test[name: String, test_fn: fn () raises -> object]() raises:
print("PASS")


def test_dict():
test_dict_construction()
test["test_basic", test_basic]()
test["test_multiple_resizes", test_multiple_resizes]()
test["test_big_dict", test_big_dict]()
test["test_compact", test_compact]()
test["test_compact_with_elements", test_compact_with_elements]()
test["test_pop_default", test_pop_default]()
test["test_key_error", test_key_error]()
test["test_iter", test_iter]()
test["test_iter_keys", test_iter_keys]()
test["test_iter_values", test_iter_values]()
test["test_iter_values_mut", test_iter_values_mut]()
test["test_iter_items", test_iter_items]()
test["test_dict_copy", test_dict_copy]()
test["test_dict_copy_add_new_item", test_dict_copy_add_new_item]()
test["test_dict_copy_delete_original", test_dict_copy_delete_original]()
test[
"test_dict_copy_calls_copy_constructor",
test_dict_copy_calls_copy_constructor,
]()
test["test_dict_update_nominal", test_dict_update_nominal]()
test["test_dict_update_empty_origin", test_dict_update_empty_origin]()
test["test_dict_update_empty_new", test_dict_update_empty_new]()
test["test_mojo_issue_1729", test_mojo_issue_1729]()
test["test dict or", test_dict_or]()


def test_taking_owned_kwargs_dict(owned kwargs: OwnedKwargsDict[Int]):
assert_equal(len(kwargs), 2)

Expand Down Expand Up @@ -480,7 +452,28 @@ def test_find_get():


def main():
test_dict()
test_dict_construction()
test_basic()
test_multiple_resizes()
test_big_dict()
test_compact()
test_compact_with_elements()
test_pop_default()
test_key_error()
test_iter()
test_iter_keys()
test_iter_values()
test_iter_values_mut()
test_iter_items()
test_dict_copy()
test_dict_copy_add_new_item()
test_dict_copy_delete_original()
test_dict_copy_calls_copy_constructor()
test_dict_update_nominal()
test_dict_update_empty_origin()
test_dict_update_empty_new()
test_mojo_issue_1729()
test_dict_or()
test_dict_string_representation_string_int()
test_dict_string_representation_int_int()
test_owned_kwargs_dict()
Expand Down
44 changes: 22 additions & 22 deletions stdlib/test/collections/test_set.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -496,25 +496,25 @@ fn test[name: String, test_fn: fn () raises -> object]() raises:


def main():
test["test_set_construction", test_set_construction]()
test["test_len", test_len]()
test["test_in", test_in]()
test["test_equal", test_equal]()
test["test_bool", test_bool]()
test["test_intersection", test_intersection]()
test["test_union", test_union]()
test["test_subtract", test_subtract]()
test["test_difference_update", test_difference_update]()
test["test_iter", test_iter]()
test["test_add", test_add]()
test["test_remove", test_remove]()
test["test_pop_insertion_order", test_pop_insertion_order]()
test["test_issubset", test_issubset]()
test["test_disjoint", test_disjoint]()
test["test_issuperset", test_issuperset]()
test["test_greaterthan", test_greaterthan]()
test["test_lessthan", test_lessthan]()
test["test_symmetric_difference", test_symmetric_difference]()
test["test_symmetric_difference_update", test_symmetric_difference_update]()
test["test_discard", test_discard]()
test["test_clear", test_clear]()
test_set_construction()
test_len()
test_in()
test_equal()
test_bool()
test_intersection()
test_union()
test_subtract()
test_difference_update()
test_iter()
test_add()
test_remove()
test_pop_insertion_order()
test_issubset()
test_disjoint()
test_issuperset()
test_greaterthan()
test_lessthan()
test_symmetric_difference()
test_symmetric_difference_update()
test_discard()
test_clear()

0 comments on commit fe2adb6

Please sign in to comment.