9 #include "gmock/gmock.h"
10 #include "gtest/gtest.h"
15 namespace hardened_memory_unittest {
18 using ::testing::Each;
19 using ::testing::ElementsAre;
21 TEST(HardenedMemory, Memcpy) {
22 std::vector<uint32_t> xs = {1, 2, 3, 4, 5, 6, 7, 8};
23 std::vector<uint32_t> ys(8);
26 EXPECT_THAT(ys, Each(0));
29 EXPECT_THAT(ys, ElementsAre(0, 1, 2, 3, 4, 5, 6, 7));
32 constexpr uint32_t kRandomWord = 0xdeadbeef;
36 extern "C" size_t hardened_memshred_random_word() {
return kRandomWord; }
38 TEST(HardenedMemory, MemShred) {
39 std::vector<uint32_t> xs = {1, 2, 3, 4, 5, 6, 7, 8};
42 EXPECT_THAT(xs, Each(kRandomWord));
45 TEST(HardenedMemory, MemEq) {
46 std::vector<uint32_t> xs = {1, 2, 3, 4, 5, 6, 7, 8};
47 std::vector<uint32_t> ys = xs;