|
@@ -13,7 +13,7 @@
|
13
|
13
|
} while (0)
|
14
|
14
|
|
15
|
15
|
#define TEST_byteArrayToString(STR, DATA, SIZE) \
|
16
|
|
- EXPECT_EQ(STR, ScHex::byteArrayToString(std::string((char*)memcpy(new BYTE[SIZE], DATA, SIZE), SIZE)))
|
|
16
|
+ ASSERT_EQ(STR, ScHex::byteArrayToString(std::string((char*)memcpy(new BYTE[SIZE], DATA, SIZE), SIZE)))
|
17
|
17
|
|
18
|
18
|
TEST(Hex, ByteArrayToString)
|
19
|
19
|
{
|
|
@@ -22,8 +22,8 @@ TEST(Hex, ByteArrayToString)
|
22
|
22
|
|
23
|
23
|
#define TEST_stringToByteArray(STR, DATA, SIZE) do { \
|
24
|
24
|
auto bytes = ScHex::stringToByteArray(STR); \
|
25
|
|
- EXPECT_EQ(SIZE, bytes.size()); \
|
26
|
|
- EXPECT_EQ(0, memcmp(bytes.data(), DATA, SIZE)); \
|
|
25
|
+ ASSERT_EQ(SIZE, bytes.size()); \
|
|
26
|
+ ASSERT_EQ(0, memcmp(bytes.data(), DATA, SIZE)); \
|
27
|
27
|
} while (0)
|
28
|
28
|
|
29
|
29
|
TEST(Hex, StringToByteArray)
|
|
@@ -35,21 +35,21 @@ TEST(Reader, Test1)
|
35
|
35
|
{
|
36
|
36
|
std::cout << "Ensure that at lest 1 reader is connected";
|
37
|
37
|
getchar();
|
38
|
|
- EXPECT_TRUE(ScReader::establishContext());
|
|
38
|
+ ASSERT_TRUE(ScReader::establishContext());
|
39
|
39
|
auto readers = ScReader::getReaders();
|
40
|
|
- EXPECT_GE(readers.size(), 1);
|
|
40
|
+ ASSERT_GE(readers.size(), 1);
|
41
|
41
|
for (auto reader : readers)
|
42
|
42
|
{
|
43
|
43
|
std::cout << reader->getName() << std::endl;
|
44
|
44
|
}
|
45
|
45
|
auto reader = readers[0];
|
46
|
|
- EXPECT_TRUE(reader->connect());
|
|
46
|
+ ASSERT_TRUE(reader->connect());
|
47
|
47
|
auto res = reader->transmit(ScBasicCommand("94 A4 00 00 02 20 00 00"));
|
48
|
|
- EXPECT_NE(nullptr, res->getData().data());
|
|
48
|
+ ASSERT_NE(nullptr, res->getData().data());
|
49
|
49
|
auto resp = ScHex::byteArrayToString(res->getData());
|
50
|
50
|
std::cout << "Response (" << res->getData().size() << "): " << resp << std::endl;
|
51
|
|
- EXPECT_TRUE(reader->disconnect());
|
52
|
|
- EXPECT_TRUE(ScReader::freeContext());
|
|
51
|
+ ASSERT_TRUE(reader->disconnect());
|
|
52
|
+ ASSERT_TRUE(ScReader::freeContext());
|
53
|
53
|
}
|
54
|
54
|
|
55
|
55
|
int main(int argc, char* argv[])
|