Skip to content

Commit 6f6175d

Browse files
committed
[libc++][NFC] Fix copy-paste errors in tests
The test precision_type.pass.cpp was a duplicate of precision.pass.cpp, so it is removed. atomic_flag_test.pass.cpp was a duplicate of atomic_flag_test_and_set.pass.cpp, so instead I wrote a proper test for it. Those duplicate tests were detected with find libcxx ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD
1 parent ed7c81d commit 6f6175d

File tree

4 files changed

+11
-89
lines changed

4 files changed

+11
-89
lines changed

libcxx/test/std/atomics/atomics.flag/atomic_flag_test.pass.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
// struct atomic_flag
1414

15-
// bool atomic_flag_test_and_set(volatile atomic_flag*);
16-
// bool atomic_flag_test_and_set(atomic_flag*);
15+
// bool atomic_flag_test(const volatile atomic_flag*);
16+
// bool atomic_flag_test(const atomic_flag*);
1717

1818
#include <atomic>
1919
#include <cassert>
@@ -25,15 +25,17 @@ int main(int, char**)
2525
{
2626
std::atomic_flag f;
2727
f.clear();
28-
assert(atomic_flag_test_and_set(&f) == 0);
29-
assert(f.test_and_set() == 1);
28+
assert(atomic_flag_test(&f) == 0);
29+
assert(f.test_and_set() == 0);
30+
assert(atomic_flag_test(&f) == 1);
3031
}
3132
{
3233
volatile std::atomic_flag f;
3334
f.clear();
34-
assert(atomic_flag_test_and_set(&f) == 0);
35-
assert(f.test_and_set() == 1);
35+
assert(atomic_flag_test(&f) == 0);
36+
assert(f.test_and_set() == 0);
37+
assert(atomic_flag_test(&f) == 1);
3638
}
3739

38-
return 0;
40+
return 0;
3941
}

libcxx/test/std/atomics/atomics.flag/atomic_flag_test_explicit.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@ int main(int, char**)
111111
assert(atomic_flag_test_explicit(&f, std::memory_order_seq_cst) == 1);
112112
}
113113

114-
return 0;
114+
return 0;
115115
}

libcxx/test/std/utilities/time/time.hms/time.hms.members/precision.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ constexpr unsigned long long powers[] = {
4444
100000000000000000ULL,
4545
1000000000000000000ULL,
4646
10000000000000000000ULL
47-
};
47+
};
4848

4949
template <typename Duration, unsigned width>
5050
constexpr bool check_precision()

libcxx/test/std/utilities/time/time.hms/time.hms.members/precision_type.pass.cpp

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)