Robin Thoni 9 vuotta sitten
vanhempi
commit
acd87ebdfe
1 muutettua tiedostoa jossa 14 lisäystä ja 4 poistoa
  1. 14
    4
      tests/test_pcsc_cpp_tools.cpp

+ 14
- 4
tests/test_pcsc_cpp_tools.cpp Näytä tiedosto

@@ -31,6 +31,15 @@ TEST(Hex, StringToByteArray)
31 31
     TEST_Hex(TEST_stringToByteArray);
32 32
 }
33 33
 
34
+#define TEST_command(STR) do {                              \
35
+    auto res = reader->transmit(ScBasicCommand(STR));       \
36
+    ASSERT_NE(nullptr, res->getData().data());              \
37
+    auto resp = ScHex::byteArrayToString(res->getData());   \
38
+    std::cout << "Response (" << res->getData().size()      \
39
+        << "): " << resp << std::endl;                      \
40
+    } while (0)
41
+
42
+
34 43
 TEST(Reader, Test1)
35 44
 {
36 45
     std::cout << "Ensure that at lest 1 reader is connected";
@@ -46,10 +55,11 @@ TEST(Reader, Test1)
46 55
     ASSERT_TRUE(reader->connect());
47 56
     std::cout << "ATR: " << ScHex::byteArrayToString(reader->getAtr())
48 57
         << " Result: " << reader->getLastResultString() << std::endl;
49
-    auto res = reader->transmit(ScBasicCommand("94 A4 00 00 02 20 00 00"));
50
-    ASSERT_NE(nullptr, res->getData().data());
51
-    auto resp = ScHex::byteArrayToString(res->getData());
52
-    std::cout << "Response (" << res->getData().size() << "): " << resp << std::endl;
58
+
59
+    TEST_command("94a4 0800 04 2000 2020");
60
+    TEST_command("94b2 0104 1d");
61
+    TEST_command("94d2 0000 1d 5A 00 E0 00 00 50 5C 7C 58 B2 2A DA 8C 20 01 EA D9 80 1E 04 40 20 0E 3F FF FF FF FF FF");
62
+
53 63
     ASSERT_TRUE(reader->disconnect());
54 64
     ASSERT_TRUE(ScReader::freeContext());
55 65
 }

Loading…
Peruuta
Tallenna