diff --git a/stdlib/test/builtin/test_hash.mojo b/stdlib/test/builtin/test_hash.mojo index 3653ef329..76ccae8dc 100644 --- a/stdlib/test/builtin/test_hash.mojo +++ b/stdlib/test/builtin/test_hash.mojo @@ -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() diff --git a/stdlib/test/collections/test_dict.mojo b/stdlib/test/collections/test_dict.mojo index 27fd1523e..0d250d835 100644 --- a/stdlib/test/collections/test_dict.mojo +++ b/stdlib/test/collections/test_dict.mojo @@ -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) @@ -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() diff --git a/stdlib/test/collections/test_set.mojo b/stdlib/test/collections/test_set.mojo index 9c22bce2c..08d5235bf 100644 --- a/stdlib/test/collections/test_set.mojo +++ b/stdlib/test/collections/test_set.mojo @@ -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()