-
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
def test_generate_all_robots
all_names_count = 26 * 26 * 1000
time_limit = Time.now + 60 # seconds
seen_names = Hash.new(0)
robots = []
while seen_names.size < all_names_count && Time.now < time_limit
robot = Robot.new
seen_names[robot.name] += 1
robots << robot
end
assert_equal all_names_count, robots.size, timeout_message
end
I believe that the while
loop here leads to non-deterministic behavior. The amount of robots generated is almost always different than the expected number because the loop uses the length of the seen_names
keys and fails to take into consideration the total number of times a name was created
Metadata
Metadata
Assignees
Labels
No labels