dcsctp: Add test for StrongAlias<bool> as bool
This test verifies that a StrongAlias<bool> can be evaluated as a boolean without dereferencing it. Note that this is not the case for StrongAlias<int>, for example, as that wouldn't even compile. Which is quite good. Bug: webrtc:12614 Change-Id: I67329364721fe0354d78daac1233254035454c03 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215686 Reviewed-by: Florent Castelli <orphis@webrtc.org> Commit-Queue: Victor Boivie <boivie@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33787}
This commit is contained in:
committed by
Commit Bot
parent
437d129ef5
commit
59d6e2a19e
@ -347,4 +347,16 @@ TEST(StrongAliasTest, EnsureConstexpr) {
|
||||
static_assert(kOne > kZero, "");
|
||||
static_assert(kOne >= kZero, "");
|
||||
}
|
||||
|
||||
TEST(StrongAliasTest, BooleansAreEvaluatedAsBooleans) {
|
||||
using BoolAlias = StrongAlias<class BoolTag, bool>;
|
||||
|
||||
BoolAlias happy(true);
|
||||
BoolAlias sad(false);
|
||||
|
||||
EXPECT_TRUE(happy);
|
||||
EXPECT_FALSE(sad);
|
||||
EXPECT_TRUE(*happy);
|
||||
EXPECT_FALSE(*sad);
|
||||
}
|
||||
} // namespace dcsctp
|
||||
|
||||
Reference in New Issue
Block a user