27 #include <gtest/gtest.h>
45 msg1_ <<
"S_MY_WIEGAND_1";
47 msg1_ <<
"af:bc:12:42";
50 msg2_ <<
"S_MY_WIEGAND_1";
54 msg3_ <<
"S_MY_WIEGAND_1";
56 msg3_ <<
"af:bc:12:42";
86 ASSERT_TRUE(builder_.extract_source_name(
"S_MY_DEVICE", &out));
87 ASSERT_EQ(out,
"MY_DEVICE");
89 ASSERT_TRUE(builder_.extract_source_name(
"S___MY_DEVICE", &out));
90 ASSERT_EQ(out,
"__MY_DEVICE");
92 ASSERT_FALSE(builder_.extract_source_name(
"MY_DEVICE", &out));
93 ASSERT_FALSE(builder_.extract_source_name(
"", &out));
94 ASSERT_FALSE(builder_.extract_source_name(
"S_", &out));
95 ASSERT_FALSE(builder_.extract_source_name(
"D", &out));
101 ASSERT_TRUE(auth_source.get());
105 ASSERT_TRUE(spec.get());
106 ASSERT_EQ(
"af:bc:12:42", spec->card_id());
107 ASSERT_EQ(32, spec->nb_bits());
113 ASSERT_TRUE(auth_source.get());
116 Cred::PinCodePtr spec = std::dynamic_pointer_cast<Cred::PinCode>(auth_source);
117 ASSERT_TRUE(spec.get());
118 ASSERT_EQ(
"1234", spec->pin_code());
124 ASSERT_TRUE(auth_source.get());
128 std::dynamic_pointer_cast<Cred::RFIDCardPin>(auth_source);
129 ASSERT_TRUE(spec.get());
130 ASSERT_EQ(
"af:bc:12:42", spec->card().card_id());
131 ASSERT_EQ(32, spec->card().nb_bits());
132 ASSERT_EQ(
"1234", spec->pin().pin_code());