-
-
Notifications
You must be signed in to change notification settings - Fork 200
Open
Description
- From description I expect the tests to check the triangle, I wouldn't expect that test wants all rows of numbers to be of same length and to end with zeroes. This prevents several solutions that I imagined while solving:
- to reserve exactly the needed space for every row (for me it failed for ten rows test)
- even hackier solution that takes into account that rows always start and end with 1, so creating an array containing
{1, 1, 2, 1, 3, 3, 1, 4, 6, 4, 1}
and an array of pointers at right positions should be the right solution.
- Is there really a need to free in
tearDown
? Leaked memory should be freed anyway after all tests finish (or am I missing something?), but having expectation about used structure intearDown
may cause a segmentation fault instead of a list of failing tests in casefree
is called on wrong pointer. I went with reserving space for all rows in onemalloc
to save on calls and reduce memory usage and had problems understanding that for me the case with 0 rows was failing and causingfree
to cause segmentation fault. It was introduced in Update tests_pascals_triangle.c: Fix memory leaks #755 and probably better to ping @bobahop - Why does zero rows expect
{ { 0 } }
in result, shouldn't it be expecting 0 rows, or even be ok withNULL
?
Metadata
Metadata
Assignees
Labels
No labels