Skip to content

Commit

Permalink
Test noexcept of Mask::operator[]
Browse files Browse the repository at this point in the history
Refs: gh-115
Signed-off-by: Matthias Kretz <kretz@kde.org>
  • Loading branch information
mattkretz committed Mar 30, 2016
1 parent feb1be7 commit d4398de
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions tests/scalaraccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,29 @@ TEST_TYPES(V, operators, (ALL_VECTORS, SIMD_ARRAY_LIST))
TEST_TYPES(V, ensure_noexcept, (ALL_VECTORS, SIMD_ARRAY_LIST))
{
V a{};
const V &b = a;
EntryType<V> x = a[0]; if (x == x) {}
VERIFY(noexcept(a[0]));
VERIFY(noexcept(x = b[0]));
VERIFY(noexcept(x = a[0]));
VERIFY(noexcept(a[0] = 1));
VERIFY(noexcept(a[0] += 1));
VERIFY(noexcept(a[0] -= 1));
VERIFY(noexcept(a[0] *= 1));
VERIFY(noexcept(a[0] /= 1));
VERIFY(noexcept(++a[0]));
VERIFY(noexcept(--a[0]));
VERIFY(noexcept(a[0]++));
VERIFY(noexcept(a[0]--));
{
const V &b = a;
EntryType<V> x = a[0]; if (x == x) {}
VERIFY(noexcept(a[0]));
VERIFY(noexcept(x = b[0]));
VERIFY(noexcept(x = a[0]));
VERIFY(noexcept(a[0] = 1));
VERIFY(noexcept(a[0] += 1));
VERIFY(noexcept(a[0] -= 1));
VERIFY(noexcept(a[0] *= 1));
VERIFY(noexcept(a[0] /= 1));
VERIFY(noexcept(++a[0]));
VERIFY(noexcept(--a[0]));
VERIFY(noexcept(a[0]++));
VERIFY(noexcept(a[0]--));
}
{
auto k0 = a == a;
const auto &k1 = k0;
bool x = false; if (x) {}
VERIFY(noexcept(k0[0]));
VERIFY(noexcept(x = k1[0]));
VERIFY(noexcept(x = k0[0]));
VERIFY(noexcept(k0[0] = 1));
}
}

0 comments on commit d4398de

Please sign in to comment.