diff options
| author | Tom Lane | 2019-03-25 16:23:40 +0000 |
|---|---|---|
| committer | Tom Lane | 2019-03-25 16:23:48 +0000 |
| commit | f7ff0ae8428f9001eab244cb2535f40d29f218e9 (patch) | |
| tree | 2500496a44ba17d975924830dcfcd741ca4ceb2e /src/test | |
| parent | 9f75e3772350fb66f20a3d7f33bc94f30300d7eb (diff) | |
Further code review for new integerset code.
Mostly cosmetic adjustments, but I added a more reliable method of
detecting whether an iteration is in progress.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/modules/test_integerset/README | 8 | ||||
| -rw-r--r-- | src/test/modules/test_integerset/test_integerset.c | 15 |
2 files changed, 7 insertions, 16 deletions
diff --git a/src/test/modules/test_integerset/README b/src/test/modules/test_integerset/README index 3e4226adb55..6fd7e3c0caf 100644 --- a/src/test/modules/test_integerset/README +++ b/src/test/modules/test_integerset/README @@ -1,7 +1,7 @@ -test_integerset contains unit tests for testing the integer set implementation, -in src/backend/lib/integerset.c +test_integerset contains unit tests for testing the integer set implementation +in src/backend/lib/integerset.c. -The tests verify the correctness of the implemention, but they can also be -as a micro-benchmark: If you set the 'intset_tests_stats' flag in +The tests verify the correctness of the implementation, but they can also be +used as a micro-benchmark. If you set the 'intset_tests_stats' flag in test_integerset.c, the tests will print extra information about execution time and memory usage. diff --git a/src/test/modules/test_integerset/test_integerset.c b/src/test/modules/test_integerset/test_integerset.c index eec9e7d0ce9..346bb779bf3 100644 --- a/src/test/modules/test_integerset/test_integerset.c +++ b/src/test/modules/test_integerset/test_integerset.c @@ -27,7 +27,7 @@ * how much memory the test set consumed. That can be used as * micro-benchmark of various operations and input patterns (you might * want to increase the number of values used in each of the test, if - * you do that, to reduce noise) + * you do that, to reduce noise). * * The information is printed to the server's stderr, mostly because * that's where MemoryContextStats() output goes. @@ -39,7 +39,7 @@ PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(test_integerset); /* - * A struct to define a pattern of integers, for use with test_pattern() + * A struct to define a pattern of integers, for use with the test_pattern() * function. */ typedef struct @@ -105,12 +105,6 @@ static void test_huge_distances(void); Datum test_integerset(PG_FUNCTION_ARGS) { - MemoryContext test_ctx; - - test_ctx = AllocSetContextCreate(CurrentMemoryContext, - "test_integerset context", - ALLOCSET_DEFAULT_SIZES); - /* Tests for various corner cases */ test_empty(); test_huge_distances(); @@ -127,12 +121,9 @@ test_integerset(PG_FUNCTION_ARGS) /* Test different test patterns, with lots of entries */ for (int i = 0; i < lengthof(test_specs); i++) { - MemoryContextReset(test_ctx); test_pattern(&test_specs[i]); } - MemoryContextDelete(test_ctx); - PG_RETURN_VOID(); } @@ -378,7 +369,7 @@ test_single_value(uint64 value) * - all integers between 'filler_min' and 'filler_max'. * * This exercises different codepaths than testing just with a single value, - * because the implementation buffers newly-added values. If we add just + * because the implementation buffers newly-added values. If we add just a * single value to the set, we won't test the internal B-tree code at all, * just the code that deals with the buffer. */ |
