Hm, not really. Try to add a print(matches(*i)) in the end of the random tests and you'll see that all tests still evaluate to False. Like this:
for i in random_ips:
print(matches(*i))
test.assert_equals(matches(*i), reference_solution(*i))
Read my last post carefully and see if you can make 50% of the random tests evaluate to True.
The way I do it is to randomize test data until I get variables that makes the match() function return true, the next return value must be false, then true and so on. If you randomize a wildcard mask that looks like this 00000000.00001111.11111111.11111111 the likelyhood if getting variables that return true is much greater.
Have a look at my tests Test(match, random) { } under the C Kata Reference.
. . . only creates a reference to arr, then all changes on arr2 will be reflected on arr too. arr2 = arr[:] would be more efficient to your purpose.
; )
According to condition (1), this is the desired behavior. I added a sentence to (2) to make this clearer:
"NOTE: When the array is both not square and the wrong size, (1) applies, so "Array not square" should be returned."
Great, now it works :) I made some final adjustments to the description and naming, but now it is approved and published.
Hm, not really. Try to add a
print(matches(*i))
in the end of the random tests and you'll see that all tests still evaluate toFalse
. Like this:Read my last post carefully and see if you can make 50% of the random tests evaluate to
True
.The way I do it is to randomize test data until I get variables that makes the
match()
function returntrue
, the next return value must befalse
, thentrue
and so on. If you randomize a wildcard mask that looks like this00000000.00001111.11111111.11111111
the likelyhood if getting variables that returntrue
is much greater.Have a look at my tests
Test(match, random) { }
under the C Kata Reference.I'm a bit unsure if it should be translated into Python, but I have approved it. It sure is slightly harder in C though.
I'm not sure about C but this is not a 6kyu kata in Python.
I think your first line . . .
. . . only creates a reference to
arr
, then all changes onarr2
will be reflected onarr
too.arr2 = arr[:]
would be more efficient to your purpose.; )