-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ZenUnit::RandomSpan<T>(), ZenUnit::RandomNonEmptySpan<T>(), and Z…
…enUnit::RandomSpanWithSize<T>(size_t)
- Loading branch information
1 parent
026c7c6
commit ed10dc7
Showing
6 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ZenUnitLibraryTests/StaticComponents/ToStringer/TypeTraits/is_span_vTests.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "pch.h" | ||
|
||
namespace ZenUnit | ||
{ | ||
TESTS(is_span_vTests) | ||
AFACT(is_span_v_TIsNotAVector_ValueIsFalse) | ||
AFACT(is_span_v_TIsAVector_ValueIsTrue) | ||
EVIDENCE | ||
|
||
TEST(is_span_v_TIsNotAVector_ValueIsFalse) | ||
{ | ||
IS_FALSE(is_span_v<int>); | ||
IS_FALSE(is_span_v<string>); | ||
} | ||
|
||
TEST(is_span_v_TIsAVector_ValueIsTrue) | ||
{ | ||
IS_TRUE(is_span_v<span<int>>); | ||
IS_TRUE(is_span_v<span<string>>); | ||
} | ||
|
||
RUN_TESTS(is_span_vTests) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
ZenUnitUtilsAndAssertionTests/StaticComponents/RandomSpanTests.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "pch.h" | ||
|
||
namespace ZenUnit | ||
{ | ||
template<typename T> | ||
TEMPLATE_TESTS(RandomSpanTests, T) | ||
FACTS(RandomSpanWithSize_ReturnsASpanWithSpecifiedSize) | ||
AFACT(RandomSpan_ReturnsASpanWithSizeBetween0And2) | ||
AFACT(RandomNonEmptySpan_ReturnsASpanWithSizeBetween1And3) | ||
EVIDENCE | ||
|
||
TEST1X1(RandomSpanWithSize_ReturnsASpanWithSpecifiedSize, | ||
size_t size, | ||
0ULL, | ||
1ULL, | ||
5ULL) | ||
{ | ||
const span<T> randomSpanWithSize = ZenUnit::RandomSpanWithSize<T>(size); | ||
ARE_EQUAL(size, randomSpanWithSize.size()); | ||
} | ||
|
||
TEST(RandomSpan_ReturnsASpanWithSizeBetween0And2) | ||
{ | ||
const span<T> randomSpan = ZenUnit::RandomSpan<T>(); | ||
IS_TRUE(randomSpan.size() <= 3); | ||
} | ||
|
||
TEST(RandomNonEmptySpan_ReturnsASpanWithSizeBetween1And3) | ||
{ | ||
const span<T> randomNonEmptySpan = ZenUnit::RandomNonEmptySpan<T>(); | ||
IS_TRUE(randomNonEmptySpan.size() >= 1 && randomNonEmptySpan.size() <= 3); | ||
} | ||
|
||
RUN_TEMPLATE_TESTS(RandomSpanTests, int) | ||
THEN_RUN_TEMPLATE_TESTS(RandomSpanTests, string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters