Closed bogdanm closed 9 years ago
@0xc0170 , @autopulated , new Array implementation is here!
I'm going to wait a bit more, then merge this.
:+1: apart from typo. mayyyyyybe a "capacity" function would make more sense than get_num_zones in the public API too, but whatever.
Thanks, I'll fix the typo. I share your thoughts about get_num_zones
, but I feel that's needed for testing, and I don't have a good way to do public_for_testing_only:
:) I'll add get_capacity
though.
yeah I guess some sort of #ifdef WE_ARE_TESTING_ETC would be useful, or even a macro to do test_visibility:
in the class declaration. Although that would only work OK in headers pulled into tests. You wouldn't be able to compile a library differently for testing vs. not. because we don't currently recompile dependencies differently for your tests and main application, and I'm not sure that would even be a good idea.
There's a simpler, less hack-ish way, but the result looks weird: derive an ArrayForTesting
class from Array
and add the test-only methods there. But yeah, that's creepy.
Array is a simple container class that can be accessed using indexes (array[i]). It can grow automatically and is reentrant.