-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_state.cpp
More file actions
26 lines (21 loc) · 810 Bytes
/
Copy pathtest_state.cpp
File metadata and controls
26 lines (21 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <catch2/catch.hpp>
#include <faasm/state.h>
using namespace faasm;
namespace tests {
TEST_CASE("Test masking doubles", "[state]")
{
// Mask of zeros to start with
std::vector<uint8_t> byteMaskArray = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// Mask a double in the middle
auto intArray = reinterpret_cast<unsigned int*>(byteMaskArray.data());
maskDouble(intArray, 1);
std::vector<uint8_t> expected = {
0, 0, 0, 0, 0,
0, 0, 0, BIT_MASK_8, BIT_MASK_8,
BIT_MASK_8, BIT_MASK_8, BIT_MASK_8, BIT_MASK_8, BIT_MASK_8,
BIT_MASK_8, 0, 0, 0, 0
};
REQUIRE(byteMaskArray == expected);
}
}