Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cleanups: Test code #4122

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/std/include/range_algorithm_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ template <class>
inline constexpr bool always_false = false;

namespace detail {
static constexpr bool permissive() {
constexpr bool permissive() {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/std/include/test_mdspan_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ constexpr void check_members_with_various_extents(Fn&& fn) {
}

namespace details {
static constexpr bool permissive() {
constexpr bool permissive() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct B {

struct X : public B {};

void test_294051() {
void test_DevDiv_294051() {
shared_ptr<B> b(new B);
shared_ptr<X> x(new X);

Expand Down Expand Up @@ -121,5 +121,5 @@ void test_294051() {
int main() {
test_orig();

test_294051();
test_DevDiv_294051();
}
2 changes: 1 addition & 1 deletion tests/std/tests/Dev10_646244_bad_alloc_message/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
using namespace std;

int main() {
assert(strcmp(std::bad_alloc().what(), "bad allocation") == 0);
assert(strcmp(bad_alloc().what(), "bad allocation") == 0);
}
6 changes: 3 additions & 3 deletions tests/std/tests/Dev10_722102_shared_ptr_nullptr/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ void test_exception() {
try {
shared_ptr<int>{nullptr, NullptrDeleter{}};
abort();
} catch (bad_alloc&) {
} catch (const bad_alloc&) {
}
try {
shared_ptr<int>{nullptr, NullptrDeleter{}, allocator<int>{}};
abort();
} catch (bad_alloc&) {
} catch (const bad_alloc&) {
}
g_throw_on_alloc = false;
}
Expand Down Expand Up @@ -286,7 +286,7 @@ namespace unique_ptr_ {
try {
shared_ptr<int>{move(up)};
abort();
} catch (bad_alloc&) {
} catch (const bad_alloc&) {
}
g_throw_on_alloc = false;
assert(up.get() == rawptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void test_push_back_pop_front() {

// Also test Dev10-391805 "STL: Prefast error in deque".

void test_391805() {
void test_Dev10_391805() {
deque<int> d;

d.push_back(10);
Expand Down Expand Up @@ -262,7 +262,7 @@ void test_exception_safety_for_throwing_movable() {
int main() {
test_push_back_pop_front();

test_391805();
test_Dev10_391805();

test_exception_safety_for_nonswappable_movable();
test_exception_safety_for_throwing_movable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void assert_no_leaks() {
#endif
}

void test_484720();
void test_DevDiv_484720();

int main() {
// DevDiv-452211 "<thread>: init_at_thread_exit_mutex() creates a spurious memory leak"
Expand Down Expand Up @@ -80,7 +80,7 @@ int main() {

assert_no_leaks();

test_484720();
test_DevDiv_484720();

assert_no_leaks();

Expand Down Expand Up @@ -183,7 +183,7 @@ void f2(locked_list<elt<int>>& lst) {
assert(i == lst.end());
}

void test_484720() {
void test_DevDiv_484720() {
locked_list<elt<int>> lst;
lst.emplace_back(1);

Expand Down
12 changes: 6 additions & 6 deletions tests/std/tests/Dev11_0836436_get_time/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ tuple<int, int, int> read_time(const char* const s) {
return make_tuple(t.tm_hour, t.tm_min, t.tm_sec);
}

void test_640278();
void test_990695();
void test_DevDiv_640278();
void test_DevDiv_990695();
void test_locale_russian();
void test_locale_german();
void test_locale_chinese();
Expand Down Expand Up @@ -148,8 +148,8 @@ int main() {

assert(read_time("15 : 47 : 60") == make_tuple(15, 47, 60));

test_640278();
test_990695();
test_DevDiv_640278();
test_DevDiv_990695();
test_locale_russian();
test_locale_german();
test_locale_chinese();
Expand All @@ -171,7 +171,7 @@ void test_year(const string& str, const ios_base::iostate expected_err, const in
assert(t.tm_year == expected_tm_year);
}

void test_640278() {
void test_DevDiv_640278() {
test_year("", ios_base::eofbit | ios_base::failbit, 0);

test_year("xyz", ios_base::failbit, 0);
Expand All @@ -197,7 +197,7 @@ void test_640278() {
}

// DevDiv-990695 "<locale>: time_get should ignore ios_base::iostate's initial value"
void test_990695() {
void test_DevDiv_990695() {
for (int k = 0; k < 2; ++k) {
const auto Bit = k == 0 ? ios_base::goodbit : ios_base::failbit;

Expand Down
12 changes: 6 additions & 6 deletions tests/std/tests/Dev11_0920385_list_sort_allocator/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ struct MyAlloc {
}
};

void test_1119194();
void test_1184701();
void test_DevDiv_1119194();
void test_DevDiv_1184701();
void test_LWG_2455();
void test_allocator_construct_const();

Expand Down Expand Up @@ -279,8 +279,8 @@ int main() {
#endif // _HAS_FUNCTION_ALLOCATOR_SUPPORT
#endif // _M_CEE_PURE

test_1119194();
test_1184701();
test_DevDiv_1119194();
test_DevDiv_1184701();
test_LWG_2455();
#if !_HAS_CXX20 // support removed in C++20 by P0619R4
test_allocator_construct_const();
Expand Down Expand Up @@ -328,7 +328,7 @@ void test_swap_copy_move() {
a = move(b);
}

void test_1119194() {
void test_DevDiv_1119194() {
using AB = NoProp<bool>;
using AC = NoProp<char>;
using AI = NoProp<int>;
Expand Down Expand Up @@ -395,7 +395,7 @@ struct NonVoid {
}
};

void test_1184701() {
void test_DevDiv_1184701() {
const vector<int, NonVoid<int>> v = {11, 22, 33};

assert(v[1] == 22);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void test_case_find_first_of_parallel(const size_t testSize) {
iota(candidates.begin(), candidates.end(), 0);
auto expected = tmp.begin();
auto candidatesBegin = candidates.begin();
const auto limit = std::min(testSize, quadratic_complexity_case_limit);
const auto limit = min(testSize, quadratic_complexity_case_limit);
for (size_t idx = 0; idx < limit; ++idx) {
assert(expected == find_first_of(par, tmp.begin(), tmp.end(), candidatesBegin, candidates.end()));
++candidatesBegin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void test_case_is_heap_parallel(const size_t testSize) {
v[0] = 0;

// (0, testSize - 1]
const auto limit = std::min(testSize, quadratic_complexity_case_limit);
const auto limit = min(testSize, quadratic_complexity_case_limit);
for (auto i = 1U; i < limit; ++i) {
v[i] = 1;
assert(!is_heap(par, v.begin(), v.end()));
Expand Down
4 changes: 2 additions & 2 deletions tests/std/tests/P0083R3_splicing_maps_and_sets/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ void test_node_handle(NodeHandle& nh1, NodeHandle& nh2, Validator1 v1, Validator
static_assert(std::is_nothrow_default_constructible_v<NodeHandle>);
CHECK_EMPTY(NodeHandle{});
#ifndef _M_CEE // TRANSITION, VSO-1664382
#ifdef __cpp_constinit
#if _HAS_CXX20
#pragma warning(suppress : 4640) // C4640 emitted by MSVC because 'NodeHandle' type has non-trivial dtor
{ static constinit NodeHandle static_handle{}; }
#endif // ^^^ __cpp_constinit ^^^
#endif // ^^^ _HAS_CXX20 ^^^
#endif // _M_CEE

// No copies!
Expand Down
6 changes: 3 additions & 3 deletions tests/std/tests/P0088R3_variant/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7227,17 +7227,17 @@ namespace msvc {
try {
std::visit(very_useful_visitor, v);
abort();
} catch (std::bad_variant_access&) {
} catch (const std::bad_variant_access&) {
}
try {
std::visit(very_useful_visitor, my_variant{42}, v);
abort();
} catch (std::bad_variant_access&) {
} catch (const std::bad_variant_access&) {
}
try {
std::visit(very_useful_visitor, v, my_variant{42});
abort();
} catch (std::bad_variant_access&) {
} catch (const std::bad_variant_access&) {
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/std/tests/P0218R1_filesystem/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,7 @@ void test_copy_directory_as_symlink() {
try {
copy(dirpath, L"./symlink"sv, copy_options::create_symlinks);
EXPECT(false);
} catch (filesystem_error& e) {
} catch (const filesystem_error& e) {
EXPECT(e.code().value() == static_cast<int>(errc::is_a_directory));
}
{
Expand Down
10 changes: 5 additions & 5 deletions tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ namespace {
try {
(void) nmr.allocate(size, align);
CHECK(false);
} catch (std::bad_alloc&) {
} catch (const std::bad_alloc&) {
}
}
}
Expand Down Expand Up @@ -617,7 +617,7 @@ namespace {
try {
(void) alloc.allocate(size_max / sizeof(T) + 1);
CHECK(false);
} catch (std::bad_alloc&) {
} catch (const std::bad_alloc&) {
}
}

Expand Down Expand Up @@ -1114,7 +1114,7 @@ namespace {
try {
(void) mbr.allocate(1, 1);
CHECK(false);
} catch (std::bad_alloc&) {
} catch (const std::bad_alloc&) {
// nothing to do
}
}
Expand Down Expand Up @@ -1150,7 +1150,7 @@ namespace {
do {
(void) mbr.allocate(1, 1);
} while (rr.allocations_.size() < N);
} catch (std::bad_alloc&) {
} catch (const std::bad_alloc&) {
}

std::vector<std::size_t> sizes;
Expand Down Expand Up @@ -1324,7 +1324,7 @@ namespace {
do {
(void) upr.allocate(block_size, block_size);
} while (rr.allocations_.size() < N + idl);
} catch (std::bad_alloc&) {
} catch (const std::bad_alloc&) {
}

auto const n = rr.allocations_.size() - idl;
Expand Down
4 changes: 2 additions & 2 deletions tests/std/tests/P0288R9_move_only_function/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,14 +532,14 @@ void test_except() {
try {
move_only_function<void()> f{throwing{}};
assert(false); // unreachable
} catch (runtime_error&) {
} catch (const runtime_error&) {
}

try {
fail_allocations = true;
move_only_function<void()> f{not_throwing{}};
assert(false); // unreachable
} catch (bad_alloc&) {
} catch (const bad_alloc&) {
fail_allocations = false;
}
}
Expand Down
Loading