mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -9,8 +9,8 @@
|
||||
#include "wpi/util/Chrono.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::sys;
|
||||
using namespace wpi::util;
|
||||
using namespace wpi::util::sys;
|
||||
using namespace std::chrono;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
TEST(ConvertUTFTest, ConvertUTF16LittleEndianToUTF8String) {
|
||||
// Src is the look of disapproval.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "CountCopyAndMove.hpp"
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
int CountCopyAndMove::DefaultConstructions = 0;
|
||||
int CountCopyAndMove::ValueConstructions = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef LLVM_UNITTESTS_ADT_COUNTCOPYANDMOVE_H
|
||||
#define LLVM_UNITTESTS_ADT_COUNTCOPYANDMOVE_H
|
||||
|
||||
namespace wpi {
|
||||
namespace wpi::util {
|
||||
|
||||
struct CountCopyAndMove {
|
||||
static int DefaultConstructions;
|
||||
@@ -61,6 +61,6 @@ struct CountCopyAndMove {
|
||||
static int TotalMoves() { return MoveConstructions + MoveAssignments; }
|
||||
};
|
||||
|
||||
} // end namespace wpi
|
||||
} // end namespace wpi::util
|
||||
|
||||
#endif // LLVM_UNITTESTS_ADT_COUNTCOPYANDMOVE_H
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
namespace {
|
||||
uint32_t getTestKey(int i, uint32_t *) { return i; }
|
||||
@@ -701,7 +701,7 @@ struct AlwaysEqType {
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace wpi {
|
||||
namespace wpi::util {
|
||||
template <typename T>
|
||||
struct DenseMapInfo<T, std::enable_if_t<std::is_base_of_v<A, T>>> {
|
||||
static inline T getEmptyKey() { return {static_cast<int>(~0)}; }
|
||||
@@ -721,7 +721,7 @@ template <> struct DenseMapInfo<AlwaysEqType> {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
} // namespace wpi
|
||||
} // namespace wpi::util
|
||||
|
||||
namespace {
|
||||
TEST(DenseMapCustomTest, SFINAEMapInfo) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
using namespace support;
|
||||
|
||||
#undef max
|
||||
@@ -23,34 +23,34 @@ TEST(Endian, Read) {
|
||||
unsigned char littleval[] = {0x00, 0x04, 0x03, 0x02, 0x01};
|
||||
int32_t BigAsHost = 0x00010203;
|
||||
EXPECT_EQ(BigAsHost,
|
||||
(endian::read<int32_t, wpi::endianness::big, unaligned>(bigval)));
|
||||
(endian::read<int32_t, wpi::util::endianness::big, unaligned>(bigval)));
|
||||
int32_t LittleAsHost = 0x02030400;
|
||||
EXPECT_EQ(
|
||||
LittleAsHost,
|
||||
(endian::read<int32_t, wpi::endianness::little, unaligned>(littleval)));
|
||||
(endian::read<int32_t, wpi::util::endianness::little, unaligned>(littleval)));
|
||||
|
||||
EXPECT_EQ(
|
||||
(endian::read<int32_t, wpi::endianness::big, unaligned>(bigval + 1)),
|
||||
(endian::read<int32_t, wpi::endianness::little, unaligned>(littleval +
|
||||
(endian::read<int32_t, wpi::util::endianness::big, unaligned>(bigval + 1)),
|
||||
(endian::read<int32_t, wpi::util::endianness::little, unaligned>(littleval +
|
||||
1)));
|
||||
}
|
||||
|
||||
TEST(Endian, WriteNext) {
|
||||
unsigned char bigval[] = {0x00, 0x00}, *p = bigval;
|
||||
endian::writeNext<int16_t, wpi::endianness::big>(p, short(0xaabb));
|
||||
endian::writeNext<int16_t, wpi::util::endianness::big>(p, short(0xaabb));
|
||||
EXPECT_EQ(bigval[0], 0xaa);
|
||||
EXPECT_EQ(bigval[1], 0xbb);
|
||||
EXPECT_EQ(p, bigval + 2);
|
||||
|
||||
char littleval[8] = {}, *q = littleval;
|
||||
endian::writeNext<uint32_t, wpi::endianness::little>(q, 0x44556677);
|
||||
endian::writeNext<uint32_t, wpi::util::endianness::little>(q, 0x44556677);
|
||||
EXPECT_EQ(littleval[0], 0x77);
|
||||
EXPECT_EQ(littleval[1], 0x66);
|
||||
EXPECT_EQ(littleval[2], 0x55);
|
||||
EXPECT_EQ(littleval[3], 0x44);
|
||||
EXPECT_EQ(q, littleval + 4);
|
||||
|
||||
endian::writeNext<uint32_t>(q, 0x11223344, wpi::endianness::little);
|
||||
endian::writeNext<uint32_t>(q, 0x11223344, wpi::util::endianness::little);
|
||||
EXPECT_EQ(littleval[4], 0x44);
|
||||
EXPECT_EQ(littleval[5], 0x33);
|
||||
EXPECT_EQ(littleval[6], 0x22);
|
||||
@@ -63,10 +63,10 @@ TEST(Endian, ReadBitAligned) {
|
||||
unsigned char littleval[] = {0x3f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff};
|
||||
unsigned char bigval[] = {0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xc0};
|
||||
EXPECT_EQ(
|
||||
(endian::readAtBitAlignment<int, wpi::endianness::little, unaligned>(
|
||||
(endian::readAtBitAlignment<int, wpi::util::endianness::little, unaligned>(
|
||||
&littleval[0], 6)),
|
||||
0x0);
|
||||
EXPECT_EQ((endian::readAtBitAlignment<int, wpi::endianness::big, unaligned>(
|
||||
EXPECT_EQ((endian::readAtBitAlignment<int, wpi::util::endianness::big, unaligned>(
|
||||
&bigval[0], 6)),
|
||||
0x0);
|
||||
// Test to make sure that signed right shift of 0xf0000000 is masked
|
||||
@@ -74,18 +74,18 @@ TEST(Endian, ReadBitAligned) {
|
||||
unsigned char littleval2[] = {0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00};
|
||||
unsigned char bigval2[] = {0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
EXPECT_EQ(
|
||||
(endian::readAtBitAlignment<int, wpi::endianness::little, unaligned>(
|
||||
(endian::readAtBitAlignment<int, wpi::util::endianness::little, unaligned>(
|
||||
&littleval2[0], 4)),
|
||||
0x0f000000);
|
||||
EXPECT_EQ((endian::readAtBitAlignment<int, wpi::endianness::big, unaligned>(
|
||||
EXPECT_EQ((endian::readAtBitAlignment<int, wpi::util::endianness::big, unaligned>(
|
||||
&bigval2[0], 4)),
|
||||
0x0f000000);
|
||||
// Test to make sure left shift of start bit doesn't overflow.
|
||||
EXPECT_EQ(
|
||||
(endian::readAtBitAlignment<int, wpi::endianness::little, unaligned>(
|
||||
(endian::readAtBitAlignment<int, wpi::util::endianness::little, unaligned>(
|
||||
&littleval2[0], 1)),
|
||||
0x78000000);
|
||||
EXPECT_EQ((endian::readAtBitAlignment<int, wpi::endianness::big, unaligned>(
|
||||
EXPECT_EQ((endian::readAtBitAlignment<int, wpi::util::endianness::big, unaligned>(
|
||||
&bigval2[0], 1)),
|
||||
0x78000000);
|
||||
// Test to make sure 64-bit int doesn't overflow.
|
||||
@@ -94,11 +94,11 @@ TEST(Endian, ReadBitAligned) {
|
||||
unsigned char bigval3[] = {0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
EXPECT_EQ(
|
||||
(endian::readAtBitAlignment<int64_t, wpi::endianness::little, unaligned>(
|
||||
(endian::readAtBitAlignment<int64_t, wpi::util::endianness::little, unaligned>(
|
||||
&littleval3[0], 4)),
|
||||
0x0f00000000000000);
|
||||
EXPECT_EQ(
|
||||
(endian::readAtBitAlignment<int64_t, wpi::endianness::big, unaligned>(
|
||||
(endian::readAtBitAlignment<int64_t, wpi::util::endianness::big, unaligned>(
|
||||
&bigval3[0], 4)),
|
||||
0x0f00000000000000);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ TEST(Endian, WriteBitAligned) {
|
||||
// This test ensures that signed right shift of 0xffffaa is masked
|
||||
// properly.
|
||||
unsigned char bigval[8] = {0x00};
|
||||
endian::writeAtBitAlignment<int32_t, wpi::endianness::big, unaligned>(
|
||||
endian::writeAtBitAlignment<int32_t, wpi::util::endianness::big, unaligned>(
|
||||
bigval, (int)0xffffaaaa, 4);
|
||||
EXPECT_EQ(bigval[0], 0xff);
|
||||
EXPECT_EQ(bigval[1], 0xfa);
|
||||
@@ -119,7 +119,7 @@ TEST(Endian, WriteBitAligned) {
|
||||
EXPECT_EQ(bigval[7], 0x0f);
|
||||
|
||||
unsigned char littleval[8] = {0x00};
|
||||
endian::writeAtBitAlignment<int32_t, wpi::endianness::little, unaligned>(
|
||||
endian::writeAtBitAlignment<int32_t, wpi::util::endianness::little, unaligned>(
|
||||
littleval, (int)0xffffaaaa, 4);
|
||||
EXPECT_EQ(littleval[0], 0xa0);
|
||||
EXPECT_EQ(littleval[1], 0xaa);
|
||||
@@ -133,7 +133,7 @@ TEST(Endian, WriteBitAligned) {
|
||||
// This test makes sure 1<<31 doesn't overflow.
|
||||
// Test to make sure left shift of start bit doesn't overflow.
|
||||
unsigned char bigval2[8] = {0x00};
|
||||
endian::writeAtBitAlignment<int32_t, wpi::endianness::big, unaligned>(
|
||||
endian::writeAtBitAlignment<int32_t, wpi::util::endianness::big, unaligned>(
|
||||
bigval2, (int)0xffffffff, 1);
|
||||
EXPECT_EQ(bigval2[0], 0xff);
|
||||
EXPECT_EQ(bigval2[1], 0xff);
|
||||
@@ -145,7 +145,7 @@ TEST(Endian, WriteBitAligned) {
|
||||
EXPECT_EQ(bigval2[7], 0x01);
|
||||
|
||||
unsigned char littleval2[8] = {0x00};
|
||||
endian::writeAtBitAlignment<int32_t, wpi::endianness::little, unaligned>(
|
||||
endian::writeAtBitAlignment<int32_t, wpi::util::endianness::little, unaligned>(
|
||||
littleval2, (int)0xffffffff, 1);
|
||||
EXPECT_EQ(littleval2[0], 0xfe);
|
||||
EXPECT_EQ(littleval2[1], 0xff);
|
||||
@@ -158,7 +158,7 @@ TEST(Endian, WriteBitAligned) {
|
||||
|
||||
// Test to make sure 64-bit int doesn't overflow.
|
||||
unsigned char bigval64[16] = {0x00};
|
||||
endian::writeAtBitAlignment<int64_t, wpi::endianness::big, unaligned>(
|
||||
endian::writeAtBitAlignment<int64_t, wpi::util::endianness::big, unaligned>(
|
||||
bigval64, (int64_t)0xffffffffffffffff, 1);
|
||||
EXPECT_EQ(bigval64[0], 0xff);
|
||||
EXPECT_EQ(bigval64[1], 0xff);
|
||||
@@ -178,7 +178,7 @@ TEST(Endian, WriteBitAligned) {
|
||||
EXPECT_EQ(bigval64[15], 0x01);
|
||||
|
||||
unsigned char littleval64[16] = {0x00};
|
||||
endian::writeAtBitAlignment<int64_t, wpi::endianness::little, unaligned>(
|
||||
endian::writeAtBitAlignment<int64_t, wpi::util::endianness::little, unaligned>(
|
||||
littleval64, (int64_t)0xffffffffffffffff, 1);
|
||||
EXPECT_EQ(littleval64[0], 0xfe);
|
||||
EXPECT_EQ(littleval64[1], 0xff);
|
||||
@@ -200,25 +200,25 @@ TEST(Endian, WriteBitAligned) {
|
||||
|
||||
TEST(Endian, Write) {
|
||||
unsigned char data[5];
|
||||
endian::write<int32_t, wpi::endianness::big, unaligned>(data, -1362446643);
|
||||
endian::write<int32_t, wpi::util::endianness::big, unaligned>(data, -1362446643);
|
||||
EXPECT_EQ(data[0], 0xAE);
|
||||
EXPECT_EQ(data[1], 0xCA);
|
||||
EXPECT_EQ(data[2], 0xB6);
|
||||
EXPECT_EQ(data[3], 0xCD);
|
||||
endian::write<int32_t, wpi::endianness::big, unaligned>(data + 1,
|
||||
endian::write<int32_t, wpi::util::endianness::big, unaligned>(data + 1,
|
||||
-1362446643);
|
||||
EXPECT_EQ(data[1], 0xAE);
|
||||
EXPECT_EQ(data[2], 0xCA);
|
||||
EXPECT_EQ(data[3], 0xB6);
|
||||
EXPECT_EQ(data[4], 0xCD);
|
||||
|
||||
endian::write<int32_t, wpi::endianness::little, unaligned>(data,
|
||||
endian::write<int32_t, wpi::util::endianness::little, unaligned>(data,
|
||||
-1362446643);
|
||||
EXPECT_EQ(data[0], 0xCD);
|
||||
EXPECT_EQ(data[1], 0xB6);
|
||||
EXPECT_EQ(data[2], 0xCA);
|
||||
EXPECT_EQ(data[3], 0xAE);
|
||||
endian::write<int32_t, wpi::endianness::little, unaligned>(data + 1,
|
||||
endian::write<int32_t, wpi::util::endianness::little, unaligned>(data + 1,
|
||||
-1362446643);
|
||||
EXPECT_EQ(data[1], 0xCD);
|
||||
EXPECT_EQ(data[2], 0xB6);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/Errno.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace wpi::sys;
|
||||
using namespace wpi::util::sys;
|
||||
|
||||
TEST(ErrnoTest, RetryAfterSignal) {
|
||||
EXPECT_EQ(1, RetryAfterSignal(-1, [] { return 1; }));
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <limits>
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/PointerIntPair.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include <limits>
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "wpi/util/PointerUnion.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -36,34 +36,34 @@ TYPED_TEST(STLForwardCompatRemoveCVRefTest, RemoveCVRef) {
|
||||
using From = typename TypeParam::first_type;
|
||||
using To = typename TypeParam::second_type;
|
||||
EXPECT_TRUE(
|
||||
(std::is_same<typename wpi::remove_cvref<From>::type, To>::value));
|
||||
(std::is_same<typename wpi::util::remove_cvref<From>::type, To>::value));
|
||||
}
|
||||
|
||||
TYPED_TEST(STLForwardCompatRemoveCVRefTest, RemoveCVRefT) {
|
||||
using From = typename TypeParam::first_type;
|
||||
EXPECT_TRUE((std::is_same<typename wpi::remove_cvref<From>::type,
|
||||
wpi::remove_cvref_t<From>>::value));
|
||||
EXPECT_TRUE((std::is_same<typename wpi::util::remove_cvref<From>::type,
|
||||
wpi::util::remove_cvref_t<From>>::value));
|
||||
}
|
||||
|
||||
TEST(TransformTest, TransformStd) {
|
||||
std::optional<int> A;
|
||||
|
||||
std::optional<int> B = wpi::transformOptional(A, [&](int N) { return N + 1; });
|
||||
std::optional<int> B = wpi::util::transformOptional(A, [&](int N) { return N + 1; });
|
||||
EXPECT_FALSE(B.has_value());
|
||||
|
||||
A = 3;
|
||||
std::optional<int> C = wpi::transformOptional(A, [&](int N) { return N + 1; });
|
||||
std::optional<int> C = wpi::util::transformOptional(A, [&](int N) { return N + 1; });
|
||||
EXPECT_TRUE(C.has_value());
|
||||
EXPECT_EQ(4, *C);
|
||||
}
|
||||
|
||||
TEST(TransformTest, MoveTransformStd) {
|
||||
using wpi::CountCopyAndMove;
|
||||
using wpi::util::CountCopyAndMove;
|
||||
|
||||
std::optional<CountCopyAndMove> A;
|
||||
|
||||
CountCopyAndMove::ResetCounts();
|
||||
std::optional<int> B = wpi::transformOptional(
|
||||
std::optional<int> B = wpi::util::transformOptional(
|
||||
std::move(A), [&](const CountCopyAndMove &M) { return M.val + 2; });
|
||||
EXPECT_FALSE(B.has_value());
|
||||
EXPECT_EQ(0, CountCopyAndMove::TotalCopies());
|
||||
@@ -73,7 +73,7 @@ TEST(TransformTest, MoveTransformStd) {
|
||||
|
||||
A = CountCopyAndMove(5);
|
||||
CountCopyAndMove::ResetCounts();
|
||||
std::optional<int> C = wpi::transformOptional(
|
||||
std::optional<int> C = wpi::util::transformOptional(
|
||||
std::move(A), [&](const CountCopyAndMove &M) { return M.val + 2; });
|
||||
EXPECT_TRUE(C.has_value());
|
||||
EXPECT_EQ(7, *C);
|
||||
@@ -87,23 +87,23 @@ TEST(TransformTest, TransformLlvm) {
|
||||
std::optional<int> A;
|
||||
|
||||
std::optional<int> B =
|
||||
wpi::transformOptional(A, [&](int N) { return N + 1; });
|
||||
wpi::util::transformOptional(A, [&](int N) { return N + 1; });
|
||||
EXPECT_FALSE(B.has_value());
|
||||
|
||||
A = 3;
|
||||
std::optional<int> C =
|
||||
wpi::transformOptional(A, [&](int N) { return N + 1; });
|
||||
wpi::util::transformOptional(A, [&](int N) { return N + 1; });
|
||||
EXPECT_TRUE(C.has_value());
|
||||
EXPECT_EQ(4, *C);
|
||||
}
|
||||
|
||||
TEST(TransformTest, MoveTransformLlvm) {
|
||||
using wpi::CountCopyAndMove;
|
||||
using wpi::util::CountCopyAndMove;
|
||||
|
||||
std::optional<CountCopyAndMove> A;
|
||||
|
||||
CountCopyAndMove::ResetCounts();
|
||||
std::optional<int> B = wpi::transformOptional(
|
||||
std::optional<int> B = wpi::util::transformOptional(
|
||||
std::move(A), [&](const CountCopyAndMove &M) { return M.val + 2; });
|
||||
EXPECT_FALSE(B.has_value());
|
||||
EXPECT_EQ(0, CountCopyAndMove::TotalCopies());
|
||||
@@ -113,7 +113,7 @@ TEST(TransformTest, MoveTransformLlvm) {
|
||||
|
||||
A = CountCopyAndMove(5);
|
||||
CountCopyAndMove::ResetCounts();
|
||||
std::optional<int> C = wpi::transformOptional(
|
||||
std::optional<int> C = wpi::util::transformOptional(
|
||||
std::move(A), [&](const CountCopyAndMove &M) { return M.val + 2; });
|
||||
EXPECT_TRUE(C.has_value());
|
||||
EXPECT_EQ(7, *C);
|
||||
@@ -125,19 +125,19 @@ TEST(TransformTest, MoveTransformLlvm) {
|
||||
|
||||
TEST(TransformTest, ToUnderlying) {
|
||||
enum E { A1 = 0, B1 = -1 };
|
||||
static_assert(wpi::to_underlying(A1) == 0);
|
||||
static_assert(wpi::to_underlying(B1) == -1);
|
||||
static_assert(wpi::util::to_underlying(A1) == 0);
|
||||
static_assert(wpi::util::to_underlying(B1) == -1);
|
||||
|
||||
enum E2 : unsigned char { A2 = 0, B2 };
|
||||
static_assert(
|
||||
std::is_same_v<unsigned char, decltype(wpi::to_underlying(A2))>);
|
||||
static_assert(wpi::to_underlying(A2) == 0);
|
||||
static_assert(wpi::to_underlying(B2) == 1);
|
||||
std::is_same_v<unsigned char, decltype(wpi::util::to_underlying(A2))>);
|
||||
static_assert(wpi::util::to_underlying(A2) == 0);
|
||||
static_assert(wpi::util::to_underlying(B2) == 1);
|
||||
|
||||
enum class E3 { A3 = -1, B3 };
|
||||
static_assert(std::is_same_v<int, decltype(wpi::to_underlying(E3::A3))>);
|
||||
static_assert(wpi::to_underlying(E3::A3) == -1);
|
||||
static_assert(wpi::to_underlying(E3::B3) == 0);
|
||||
static_assert(std::is_same_v<int, decltype(wpi::util::to_underlying(E3::A3))>);
|
||||
static_assert(wpi::util::to_underlying(E3::A3) == -1);
|
||||
static_assert(wpi::util::to_underlying(E3::B3) == 0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
using testing::UnorderedElementsAre;
|
||||
|
||||
TEST(SmallPtrSetTest, Assignment) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
TEST(SmallSetTest, ConstructorIteratorPair) {
|
||||
std::initializer_list<int> L = {1, 2, 3, 4, 5};
|
||||
@@ -27,7 +27,7 @@ TEST(SmallSetTest, ConstructorIteratorPair) {
|
||||
TEST(SmallSet, ConstructorRange) {
|
||||
std::initializer_list<int> L = {1, 2, 3, 4, 5};
|
||||
|
||||
SmallSet<int, 4> S(wpi::make_range(std::begin(L), std::end(L)));
|
||||
SmallSet<int, 4> S(wpi::util::make_range(std::begin(L), std::end(L)));
|
||||
EXPECT_THAT(S, testing::UnorderedElementsAreArray(L));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <cstring>
|
||||
#include <stdarg.h>
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -1175,14 +1175,14 @@ TEST(SmallVectorTest, ConstructFromSpanOfConvertibleType) {
|
||||
std::vector<From> StdVector = {From(to1), From(to2), From(to3)};
|
||||
std::span<const From> Array = StdVector;
|
||||
{
|
||||
wpi::SmallVector<To> Vector(Array);
|
||||
wpi::util::SmallVector<To> Vector(Array);
|
||||
|
||||
ASSERT_EQ(Array.size(), Vector.size());
|
||||
for (size_t I = 0; I < Array.size(); ++I)
|
||||
EXPECT_EQ(Array[I], Vector[I]);
|
||||
}
|
||||
{
|
||||
wpi::SmallVector<To, 4> Vector(Array);
|
||||
wpi::util::SmallVector<To, 4> Vector(Array);
|
||||
|
||||
ASSERT_EQ(Array.size(), Vector.size());
|
||||
ASSERT_EQ(4u, NumBuiltinElts(Vector));
|
||||
@@ -1195,14 +1195,14 @@ TEST(SmallVectorTest, ToVectorOf) {
|
||||
To to1{1}, to2{2}, to3{3};
|
||||
std::vector<From> StdVector = {From(to1), From(to2), From(to3)};
|
||||
{
|
||||
wpi::SmallVector<To> Vector = wpi::to_vector_of<To>(StdVector);
|
||||
wpi::util::SmallVector<To> Vector = wpi::util::to_vector_of<To>(StdVector);
|
||||
|
||||
ASSERT_EQ(StdVector.size(), Vector.size());
|
||||
for (size_t I = 0; I < StdVector.size(); ++I)
|
||||
EXPECT_EQ(StdVector[I], Vector[I]);
|
||||
}
|
||||
{
|
||||
auto Vector = wpi::to_vector_of<To, 4>(StdVector);
|
||||
auto Vector = wpi::util::to_vector_of<To, 4>(StdVector);
|
||||
|
||||
ASSERT_EQ(StdVector.size(), Vector.size());
|
||||
static_assert(NumBuiltinElts(Vector) == 4u);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
using namespace wpi;
|
||||
using namespace wpi::util;
|
||||
|
||||
#undef max
|
||||
|
||||
|
||||
Reference in New Issue
Block a user