@@ -13,7 +13,7 @@ class Test_SignedInfo_Fragment : public testing::Test {
1313 using Document_t = XmlFragmentDocT;
1414 uint8_t m_data[512 ] = {0 };
1515 exi_bitstream_t m_stream;
16- int encode_xmldsigFragment (exi_bitstream_t * stream, Document_t*) ;
16+ virtual int encode_xmldsigFragment (exi_bitstream_t * stream, void * document) = 0 ;
1717 template <typename StrT>
1818 static void setExiStr (StrT& out, std::string_view setStr)
1919 {
@@ -26,16 +26,8 @@ class Test_SignedInfo_Fragment : public testing::Test {
2626 out.bytesLen = Len - 1 ;
2727 memcpy (out.bytes , setStr, Len - 1 );
2828 }
29+ void WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected ();
2930};
30- class Test_SignedInfo_Fragment_ISO2 : public Test_SignedInfo_Fragment <iso2_xmldsigFragment> {
31- protected:
32- int encode_xmldsigFragment (exi_bitstream_t * stream, Document_t* document)
33- {
34- return encode_iso2_xmldsigFragment (stream, document);
35- }
36- };
37-
38-
3931
4032/* * \brief Fragment encode
4133 * \param xml_input
@@ -59,7 +51,8 @@ class Test_SignedInfo_Fragment_ISO2: public Test_SignedInfo_Fragment<iso2_xmldsi
5951 * </ns0:Reference>
6052 * </ns0:SignedInfo>
6153 */
62- TEST_F (Test_SignedInfo_Fragment_ISO2, WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected) {
54+ template <typename T>
55+ void Test_SignedInfo_Fragment<T>::WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected() {
6356 static constexpr uint8_t expected[] =
6457 " \x80\x81\x12\xb4\x3a\x3a\x38\x1d\x17\x97\xbb\xbb\xbb\x97\x3b\x99\x97\x37\xb9\x33\x97\xaa\x29\x17\xb1\xb0\xb7 "
6558 " \x37\xb7\x34\xb1\xb0\xb6\x16\xb2\xbc\x34\x97\xa1\xab\x43\xa3\xa3\x81\xd1\x79\x7b\xbb\xbb\xb9\x73\xb9\x99\x73 "
@@ -116,3 +109,37 @@ TEST_F(Test_SignedInfo_Fragment_ISO2, WhenEncodingKnownSupportedAppProtocolReque
116109 const auto memcpyRes = memcmp (m_data, expected, sizeof (expected) - 1 );
117110 ASSERT_EQ (memcpyRes, 0 );
118111}
112+
113+ class Test_SignedInfo_Fragment_ISO2 : public Test_SignedInfo_Fragment <iso2_xmldsigFragment> {
114+ protected:
115+ int encode_xmldsigFragment (exi_bitstream_t * stream, void * document) final
116+ {
117+ return encode_iso2_xmldsigFragment (stream, (Document_t*)document);
118+ }
119+ };
120+ class Test_SignedInfo_Fragment_ISO20DC : public Test_SignedInfo_Fragment <iso20_dc_xmldsigFragment> {
121+ protected:
122+ int encode_xmldsigFragment (exi_bitstream_t * stream, void * document) final
123+ {
124+ return encode_iso20_dc_xmldsigFragment (stream, (Document_t*)document);
125+ }
126+ };
127+ class Test_SignedInfo_Fragment_ISO20AC : public Test_SignedInfo_Fragment <iso20_ac_xmldsigFragment> {
128+ protected:
129+ int encode_xmldsigFragment (exi_bitstream_t * stream, void * document) final
130+ {
131+ return encode_iso20_ac_xmldsigFragment (stream, (Document_t*)document);
132+ }
133+ };
134+
135+ TEST_F (Test_SignedInfo_Fragment_ISO2, WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected) {
136+ WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected ();
137+ }
138+
139+ TEST_F (Test_SignedInfo_Fragment_ISO20AC, WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected) {
140+ WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected ();
141+ }
142+
143+ TEST_F (Test_SignedInfo_Fragment_ISO20DC, WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected) {
144+ WhenEncodingKnownSupportedAppProtocolRequest_ThenResultMatchesExpected ();
145+ }
0 commit comments