20 #include <ripple/basics/Buffer.h>
21 #include <ripple/basics/strHex.h>
22 #include <ripple/basics/Slice.h>
23 #include <ripple/beast/unit_test.h>
24 #include <ripple/conditions/Condition.h>
25 #include <ripple/conditions/Fulfillment.h>
26 #include <ripple/conditions/impl/PreimageSha256.h>
33 namespace cryptoconditions {
46 while (iter != s.
cend())
69 testcase(
"Known Vectors");
74 "A0258020E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855810100" },
76 "A02580209834876DCFB05CB167A5C24953EBA58C4AC89B1ADF57F28F2F9D09AF107EE8F0810103" },
98 BEAST_EXPECT (f1->condition() == *c1);
99 BEAST_EXPECT (f1->condition() != *c2);
100 BEAST_EXPECT (f2->condition() == *c2);
101 BEAST_EXPECT (f2->condition() != *c1);
102 BEAST_EXPECT (*c1 != *c2);
103 BEAST_EXPECT (*c1 == *c1);
104 BEAST_EXPECT (f1->condition() == f1->condition());
118 BEAST_EXPECT (!
validate(*f2, *c1));
121 BEAST_EXPECT (!
validate(*f1, *c2));
128 testcase (
"Other Types");
133 {
"A10B8000810100A204A0028000",
135 "A12A8020BB1AC5260C0141B7E54B26EC2330637C5597BF811951AC09E744AD20FF77E287810204"
139 {
"A208A004A0028000A100",
141 "A22A8020B4B84136DF48A71D73F4985C04C6767A778ECB65BA7023B4506823BEEE7631B9810204"
145 {
"A382020880820100E1EF8B24D6F76B09C81ED7752AA262F044F04A874D43809D31CEA612F99B0C97"
146 "A8B4374153E3EEF3D66616843E0E41C293264B71B6173DB1CF0D6CD558C58657706FCF097F704C48"
147 "3E59CBFDFD5B3EE7BC80D740C5E0F047F3E85FC0D75815776A6F3F23C5DC5E797139A6882E38336A"
148 "4A5FB36137620FF3663DBAE328472801862F72F2F87B202B9C89ADD7CD5B0A076F7C53E35039F67E"
149 "D17EC815E5B4305CC63197068D5E6E579BA6DE5F4E3E57DF5E4E072FF2CE4C66EB45233973875275"
150 "9639F0257BF57DBD5C443FB5158CCE0A3D36ADC7BA01F33A0BB6DBB2BF989D607112F2344D993E77"
151 "E563C1D361DEDF57DA96EF2CFC685F002B638246A5B309B981820100BD42D6569F6599AED455F96B"
152 "C0ED08ED1480BF36CD9E1467F9C6F74461C9E3A749334B2F6404AA5F9F6BAFE76C347D069250B35D"
153 "1C970C793059EE733A8193F30FA78FEC7CAE459E3DDFD7633805D476940D0CB53D7FB389DCDAEAF6"
154 "E8CF48C4B5635430E4F2BCDFE505C2C0FC17B40D93C7EDB7C261EBF43895A705E024AA0549A660F7"
155 "0A32150647522DBE6B63520497CFF8F8D5D74768A27C5B86E580BE3FCDC96F1976293CBA0D58DFC6"
156 "0B518B632A6DC1E950C43E231FE1A379AA6DDCC52C70EDF851C6C0123A964261CFDB3857CD6CD5AD"
157 "C37D8DA2CC924EDAE1D84CF6124587F274C1FA3697DA2901F0269F03B243C03B614E0385E1961FAC"
160 "A32580204849505152535455484950515253545548495051525354554849505152535455810101" },
163 {
"A4648020D75A980182B10AB7D54BFED3C964073A0EE172F3DAA62325AF021A68F707511A8140E556"
164 "4300C360AC729086E2CC806E828A84877F1EB8E5D974D873E065224901555FB8821590A33BACC61E"
165 "39701CF9B46BD25BF5F0595BBE24655141438E7A100B",
167 "A4278020799239ABA8FC4FF7EABFBC4C44E69E8BDFED993324E12ED64792ABE289CF1D5F810302"
171 for (
auto x : others)
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
static std::unique_ptr< Fulfillment > deserialize(Slice s, std::error_code &ec)
Load a fulfillment from its binary form.
int charUnHex(unsigned char c)
Converts a hex digit to the corresponding integer.
Like std::vector<char> but better.
bool validate(Fulfillment const &f, Condition const &c, Slice m)
Verify if the given message satisfies the fulfillment.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Buffer hexblob(std::string const &s)
BEAST_DEFINE_TESTSUITE(PreimageSha256, conditions, ripple)
static std::unique_ptr< Condition > deserialize(Slice s, std::error_code &ec)
Load a condition from its binary form.