diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-02-25 21:01:23 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-02-26 00:37:07 +0100 |
commit | c2ece13931dee2b91ab21da3af640f3a20a4dd77 (patch) | |
tree | 0cb958967ee5339b33240b6a25520aae14770a4e /libphobos/testsuite/libphobos.phobos/std_container_array.d | |
parent | ff43f9853d3b10e0d2694cd607da1056cb80f38a (diff) | |
download | gcc-c2ece13931dee2b91ab21da3af640f3a20a4dd77.zip gcc-c2ece13931dee2b91ab21da3af640f3a20a4dd77.tar.gz gcc-c2ece13931dee2b91ab21da3af640f3a20a4dd77.tar.bz2 |
libphobos: Generate test files for phobos testsuite
Extracts all public unittests from libphobos/src and emits them as
standalone tests in the testsuite using the tests_extractor script.
Compiling every module in the Phobos library with unittests included is
computationally expensive, and these tests are now only ran when
GCC_TEST_RUN_EXPENSIVE is not empty.
When instead just compiling the unittests and linking in the module
under test, this has been observed to reduce the time spent running the
testsuite by more than half.
libphobos/ChangeLog:
* testsuite/libphobos.phobos/shared/phobos-shared.exp: Require
is-effective-target run_expensive_tests.
* testsuite/libphobos.phobos/static/phobos-static.exp: Likewise.
* testsuite/libphobos.phobos/phobos.exp: New test.
* testsuite/libphobos.phobos/std_algorithm_comparison.d: New test.
* testsuite/libphobos.phobos/std_algorithm_iteration.d: New test.
* testsuite/libphobos.phobos/std_algorithm_mutation.d: New test.
* testsuite/libphobos.phobos/std_algorithm_searching.d: New test.
* testsuite/libphobos.phobos/std_algorithm_setops.d: New test.
* testsuite/libphobos.phobos/std_algorithm_sorting.d: New test.
* testsuite/libphobos.phobos/std_array.d: New test.
* testsuite/libphobos.phobos/std_ascii.d: New test.
* testsuite/libphobos.phobos/std_base64.d: New test.
* testsuite/libphobos.phobos/std_bigint.d: New test.
* testsuite/libphobos.phobos/std_bitmanip.d: New test.
* testsuite/libphobos.phobos/std_checkedint.d: New test.
* testsuite/libphobos.phobos/std_complex.d: New test.
* testsuite/libphobos.phobos/std_concurrency.d: New test.
* testsuite/libphobos.phobos/std_container_array.d: New test.
* testsuite/libphobos.phobos/std_container_binaryheap.d: New test.
* testsuite/libphobos.phobos/std_container_dlist.d: New test.
* testsuite/libphobos.phobos/std_container_rbtree.d: New test.
* testsuite/libphobos.phobos/std_container_slist.d: New test.
* testsuite/libphobos.phobos/std_container_util.d: New test.
* testsuite/libphobos.phobos/std_conv.d: New test.
* testsuite/libphobos.phobos/std_csv.d: New test.
* testsuite/libphobos.phobos/std_datetime_date.d: New test.
* testsuite/libphobos.phobos/std_datetime_interval.d: New test.
* testsuite/libphobos.phobos/std_datetime_package.d: New test.
* testsuite/libphobos.phobos/std_datetime_stopwatch.d: New test.
* testsuite/libphobos.phobos/std_datetime_systime.d: New test.
* testsuite/libphobos.phobos/std_datetime_timezone.d: New test.
* testsuite/libphobos.phobos/std_demangle.d: New test.
* testsuite/libphobos.phobos/std_digest_crc.d: New test.
* testsuite/libphobos.phobos/std_digest_hmac.d: New test.
* testsuite/libphobos.phobos/std_digest_md.d: New test.
* testsuite/libphobos.phobos/std_digest_murmurhash.d: New test.
* testsuite/libphobos.phobos/std_digest_package.d: New test.
* testsuite/libphobos.phobos/std_digest_ripemd.d: New test.
* testsuite/libphobos.phobos/std_digest_sha.d: New test.
* testsuite/libphobos.phobos/std_encoding.d: New test.
* testsuite/libphobos.phobos/std_exception.d: New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_affix_allocator.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_aligned_block_list.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_allocator_list.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_ascending_page_allocator.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_bitmapped_block.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_bucketizer.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_fallback_allocator.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_free_list.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_kernighan_ritchie.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_quantizer.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_region.d: New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_scoped_allocator.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_segregator.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_building_blocks_stats_collector.d:
New test.
* testsuite/libphobos.phobos/std_experimental_allocator_common.d: New test.
* testsuite/libphobos.phobos/std_experimental_allocator_gc_allocator.d: New test.
* testsuite/libphobos.phobos/std_experimental_allocator_mallocator.d: New test.
* testsuite/libphobos.phobos/std_experimental_allocator_package.d: New test.
* testsuite/libphobos.phobos/std_experimental_allocator_showcase.d: New test.
* testsuite/libphobos.phobos/std_experimental_allocator_typed.d: New test.
* testsuite/libphobos.phobos/std_file.d: New test.
* testsuite/libphobos.phobos/std_format_package.d: New test.
* testsuite/libphobos.phobos/std_format_read.d: New test.
* testsuite/libphobos.phobos/std_format_spec.d: New test.
* testsuite/libphobos.phobos/std_format_write.d: New test.
* testsuite/libphobos.phobos/std_functional.d: New test.
* testsuite/libphobos.phobos/std_getopt.d: New test.
* testsuite/libphobos.phobos/std_int128.d: New test.
* testsuite/libphobos.phobos/std_internal_cstring.d: New test.
* testsuite/libphobos.phobos/std_internal_scopebuffer.d: New test.
* testsuite/libphobos.phobos/std_json.d: New test.
* testsuite/libphobos.phobos/std_logger_core.d: New test.
* testsuite/libphobos.phobos/std_logger_nulllogger.d: New test.
* testsuite/libphobos.phobos/std_math_algebraic.d: New test.
* testsuite/libphobos.phobos/std_math_exponential.d: New test.
* testsuite/libphobos.phobos/std_math_hardware.d: New test.
* testsuite/libphobos.phobos/std_math_operations.d: New test.
* testsuite/libphobos.phobos/std_math_remainder.d: New test.
* testsuite/libphobos.phobos/std_math_rounding.d: New test.
* testsuite/libphobos.phobos/std_math_traits.d: New test.
* testsuite/libphobos.phobos/std_math_trigonometry.d: New test.
* testsuite/libphobos.phobos/std_meta.d: New test.
* testsuite/libphobos.phobos/std_mmfile.d: New test.
* testsuite/libphobos.phobos/std_numeric.d: New test.
* testsuite/libphobos.phobos/std_outbuffer.d: New test.
* testsuite/libphobos.phobos/std_package.d: New test.
* testsuite/libphobos.phobos/std_parallelism.d: New test.
* testsuite/libphobos.phobos/std_path.d: New test.
* testsuite/libphobos.phobos/std_random.d: New test.
* testsuite/libphobos.phobos/std_range_interfaces.d: New test.
* testsuite/libphobos.phobos/std_range_package.d: New test.
* testsuite/libphobos.phobos/std_range_primitives.d: New test.
* testsuite/libphobos.phobos/std_regex_package.d: New test.
* testsuite/libphobos.phobos/std_signals.d: New test.
* testsuite/libphobos.phobos/std_socket.d: New test.
* testsuite/libphobos.phobos/std_stdio.d: New test.
* testsuite/libphobos.phobos/std_string.d: New test.
* testsuite/libphobos.phobos/std_sumtype.d: New test.
* testsuite/libphobos.phobos/std_traits.d: New test.
* testsuite/libphobos.phobos/std_typecons.d: New test.
* testsuite/libphobos.phobos/std_typetuple.d: New test.
* testsuite/libphobos.phobos/std_uni_package.d: New test.
* testsuite/libphobos.phobos/std_uri.d: New test.
* testsuite/libphobos.phobos/std_utf.d: New test.
* testsuite/libphobos.phobos/std_uuid.d: New test.
* testsuite/libphobos.phobos/std_variant.d: New test.
* testsuite/libphobos.phobos/std_zlib.d: New test.
Diffstat (limited to 'libphobos/testsuite/libphobos.phobos/std_container_array.d')
-rw-r--r-- | libphobos/testsuite/libphobos.phobos/std_container_array.d | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libphobos/testsuite/libphobos.phobos/std_container_array.d b/libphobos/testsuite/libphobos.phobos/std_container_array.d new file mode 100644 index 0000000..abf8dd5 --- /dev/null +++ b/libphobos/testsuite/libphobos.phobos/std_container_array.d @@ -0,0 +1,56 @@ +pure @system unittest +{ + import std.container.array; + + auto arr = Array!int(0, 2, 3); + assert(arr[0] == 0); + assert(arr.front == 0); + assert(arr.back == 3); + + // reserve space + arr.reserve(1000); + assert(arr.length == 3); + assert(arr.capacity >= 1000); + + // insertion + arr.insertBefore(arr[1..$], 1); + assert(arr.front == 0); + assert(arr.length == 4); + + arr.insertBack(4); + assert(arr.back == 4); + assert(arr.length == 5); + + // set elements + arr[1] *= 42; + assert(arr[1] == 42); +} + +pure @system unittest +{ + import std.container.array; + + import std.algorithm.comparison : equal; + auto arr = Array!int(1, 2, 3); + + // concat + auto b = Array!int(11, 12, 13); + arr ~= b; + assert(arr.length == 6); + + // slicing + assert(arr[1 .. 3].equal([2, 3])); + + // remove + arr.linearRemove(arr[1 .. 3]); + assert(arr[0 .. 2].equal([1, 11])); +} + +pure @system unittest +{ + import std.container.array; + + auto arr = Array!bool([true, true, false, true, false]); + assert(arr.length == 5); +} + |