testString

Check string types in Keys.

testString
(
Keys...
)
(
size_t count
,)
if (
Keys.length != 0
)

Examples

 version (showAssertTags) dbg();
	testString!(string)(512, 8);
	testString!(string)(512, 32);

test map to values of type bool

 version (showAssertTags) dbg();
	alias Key = uint;
	alias Value = bool;

	auto map = RadixTreeMap!(Key, Value, TestAllocator)();
	assert(map.empty);

	static assert(map.hasValue);
	map.insert(Key.init, Value.init);

test packing of set elements

 version (showAssertTags) dbg();
	auto set = RadixTreeSet!(ulong, TestAllocator)();
	enum N = HeptLeaf1.capacity;

	foreach (immutable i; 0 .. N)
	{
		assert(!set.contains(i));

		assert(set.insert(i));
		assert(set.contains(i));

		assert(!set.insert(i));
		assert(set.contains(i));
	}

	foreach (immutable i; N .. 256)
	{
		assert(!set.contains(i));

		assert(set.insert(i));
		assert(set.contains(i));

		assert(!set.insert(i));
		assert(set.contains(i));
	}

	foreach (immutable i; 256 .. 256 + N)
	{
		assert(!set.contains(i));

		assert(set.insert(i));
		assert(set.contains(i));

		assert(!set.insert(i));
		assert(set.contains(i));
	}

	foreach (immutable i; 256 + N .. 256 + 256)
	{
		assert(!set.contains(i));

		assert(set.insert(i));
		assert(set.contains(i));

		assert(!set.insert(i));
		assert(set.contains(i));
	}
 version (showAssertTags) dbg();
	auto set = RadixTreeSet!(ubyte, TestAllocator)();
	alias Set = typeof(set);

	foreach (immutable i; 0 .. HeptLeaf1.capacity)
	{
		assert(!set.contains(i));

		assert(set.insert(i));
		assert(set.contains(i));

		assert(!set.insert(i));
		assert(set.contains(i));

		immutable rootRef = set.root.peek!(HeptLeaf1);
		assert(rootRef);
	}

	foreach (immutable i; HeptLeaf1.capacity .. 256)
	{
		assert(!set.contains(i));

		assert(set.insert(i));
		assert(set.contains(i));

		assert(!set.insert(i));
		assert(set.contains(i));
	}
 version (showAssertTags) dbg();
	import std.meta : AliasSeq;
	foreach (T; AliasSeq!(ushort, uint))
	{
		auto set = RadixTreeSet!(T, TestAllocator)();
		alias Set = typeof(set);

		foreach (immutable i; 0 .. 256)
		{
			assert(!set.contains(i));

			assert(set.insert(i));
			assert(set.contains(i));

			assert(!set.insert(i));
			assert(set.contains(i));
		}

		// 256
		assert(!set.contains(256));

		assert(set.insert(256));
		assert(set.contains(256));

		assert(!set.insert(256));
		assert(set.contains(256));

		// 257
		assert(!set.contains(257));

		assert(set.insert(257));
		assert(set.contains(257));

		assert(!set.insert(257));
		assert(set.contains(257));

		immutable rootRef = set.root.peek!(Set.DefaultBranchType*);
		assert(rootRef);
		immutable root = *rootRef;
		assert(root.prefix.length == T.sizeof - 2);

	}

Meta