Skip to content

Commit ad173dd

Browse files
committed
Bring back bad_alloc test
1 parent 97550c7 commit ad173dd

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

test/c++/nda_asan_poison.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@
1818

1919
#if defined(__has_feature)
2020
#if __has_feature(address_sanitizer)
21+
2122
#include <nda/nda.hpp>
2223
#include <sanitizer/asan_interface.h>
23-
#endif
24-
#endif
2524

2625
TEST(NDA, ASANPoison) {
27-
#if defined(__has_feature)
28-
#if __has_feature(address_sanitizer)
2926
long *p;
3027
{
3128
nda::array<long, 2> A(3, 3);
@@ -34,6 +31,7 @@ TEST(NDA, ASANPoison) {
3431
}
3532

3633
EXPECT_EQ(__asan_address_is_poisoned(p), 1);
34+
}
35+
3736
#endif
3837
#endif
39-
}

test/c++/nda_basic_array_and_view.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,3 +834,11 @@ TEST_F(NDAArrayAndView, StrideOrderOfArrays) {
834834
EXPECT_TRUE(v_c.indexmap().is_stride_order_C());
835835
EXPECT_TRUE(v_f.indexmap().is_stride_order_C());
836836
}
837+
838+
#if defined(__has_feature)
839+
#if !__has_feature(address_sanitizer)
840+
TEST_F(NDAArrayAndView, BadAlloc) {
841+
EXPECT_THROW(nda::vector<int>(long(1e16)), std::bad_alloc);
842+
}
843+
#endif
844+
#endif

0 commit comments

Comments
 (0)