Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
tester.hpp File Reference
#include <sysio/chain/controller.hpp>
#include <sysio/chain/asset.hpp>
#include <sysio/chain/contract_table_objects.hpp>
#include <sysio/chain/account_object.hpp>
#include <sysio/chain/abi_serializer.hpp>
#include <sysio/chain/unapplied_transaction_queue.hpp>
#include <fc/io/json.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/tuple/tuple_io.hpp>
#include <iosfwd>
#include <optional>
Include dependency graph for tester.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  boost::test_tools::tt_detail::print_log_value< fc::variant >
 
struct  boost::test_tools::tt_detail::print_log_value< fc::variant_object >
 
struct  boost::test_tools::tt_detail::print_log_value< fc::variant_object::entry >
 
struct  sysio::testing::mock::webauthn_private_key
 
class  sysio::testing::base_tester
 
class  sysio::testing::tester
 provides utility function to simplify the creation of unit tests More...
 
class  sysio::testing::validating_tester
 
struct  sysio::testing::fc_exception_message_is
 
struct  sysio::testing::fc_exception_message_starts_with
 
struct  sysio::testing::fc_assert_exception_message_is
 
struct  sysio::testing::fc_assert_exception_message_starts_with
 
struct  sysio::testing::sysio_assert_message_is
 
struct  sysio::testing::sysio_assert_message_starts_with
 
struct  sysio::testing::sysio_assert_code_is
 

Namespaces

namespace  boost
 
namespace  boost::test_tools
 
namespace  boost::test_tools::tt_detail
 
namespace  sysio
 
namespace  sysio::testing
 
namespace  sysio::testing::mock
 

Macros

#define REQUIRE_EQUAL_OBJECTS(left, right)
 
#define REQUIRE_MATCHING_OBJECT(left, right)
 

Typedefs

using sysio::testing::subjective_restriction_map = std::map<builtin_protocol_feature_t, protocol_feature_subjective_restrictions>
 

Enumerations

enum class  sysio::testing::setup_policy {
  sysio::testing::none , sysio::testing::old_bios_only , sysio::testing::preactivate_feature_only , sysio::testing::preactivate_feature_and_new_bios ,
  sysio::testing::old_wasm_parser , sysio::testing::full
}
 

Functions

std::ostream & operator<< (std::ostream &osm, const fc::variant &v)
 sysio::testing
 
std::ostream & operator<< (std::ostream &osm, const fc::variant_object &v)
 
std::ostream & operator<< (std::ostream &osm, const fc::variant_object::entry &e)
 
sysio::chain::asset core_from_string (const std::string &s)
 
std::vector< uint8_tsysio::testing::read_wasm (const char *fn)
 
std::vector< char > sysio::testing::read_abi (const char *fn)
 
std::string sysio::testing::read_wast (const char *fn)
 
std::string sysio::testing::read_binary_snapshot (const char *fn)
 
fc::variant sysio::testing::read_json_snapshot (const char *fn)
 
fc::variant_object sysio::testing::filter_fields (const fc::variant_object &filter, const fc::variant_object &value)
 
void sysio::testing::copy_row (const chain::key_value_object &obj, vector< char > &data)
 
bool sysio::testing::expect_assert_message (const fc::exception &ex, string expected)
 
protocol_feature_set sysio::testing::make_protocol_feature_set (const subjective_restriction_map &custom_subjective_restrictions={})
 

Macro Definition Documentation

◆ REQUIRE_EQUAL_OBJECTS

#define REQUIRE_EQUAL_OBJECTS ( left,
right )
Value:
{ auto a = fc::variant( left ); auto b = fc::variant( right ); BOOST_REQUIRE_EQUAL( true, a.is_object() ); \
BOOST_REQUIRE_EQUAL( true, b.is_object() ); \
BOOST_REQUIRE_EQUAL_COLLECTIONS( a.get_object().begin(), a.get_object().end(), b.get_object().begin(), b.get_object().end() ); }
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181

Definition at line 15 of file tester.hpp.

15#define REQUIRE_EQUAL_OBJECTS(left, right) { auto a = fc::variant( left ); auto b = fc::variant( right ); BOOST_REQUIRE_EQUAL( true, a.is_object() ); \
16 BOOST_REQUIRE_EQUAL( true, b.is_object() ); \
17 BOOST_REQUIRE_EQUAL_COLLECTIONS( a.get_object().begin(), a.get_object().end(), b.get_object().begin(), b.get_object().end() ); }

◆ REQUIRE_MATCHING_OBJECT

#define REQUIRE_MATCHING_OBJECT ( left,
right )
Value:
{ auto a = fc::variant( left ); auto b = fc::variant( right ); BOOST_REQUIRE_EQUAL( true, a.is_object() ); \
BOOST_REQUIRE_EQUAL( true, b.is_object() ); \
auto filtered = ::sysio::testing::filter_fields( a.get_object(), b.get_object() ); \
BOOST_REQUIRE_EQUAL_COLLECTIONS( a.get_object().begin(), a.get_object().end(), filtered.begin(), filtered.end() ); }
fc::variant_object filter_fields(const fc::variant_object &filter, const fc::variant_object &value)
Definition tester.cpp:96

Definition at line 19 of file tester.hpp.

19#define REQUIRE_MATCHING_OBJECT(left, right) { auto a = fc::variant( left ); auto b = fc::variant( right ); BOOST_REQUIRE_EQUAL( true, a.is_object() ); \
20 BOOST_REQUIRE_EQUAL( true, b.is_object() ); \
21 auto filtered = ::sysio::testing::filter_fields( a.get_object(), b.get_object() ); \
22 BOOST_REQUIRE_EQUAL_COLLECTIONS( a.get_object().begin(), a.get_object().end(), filtered.begin(), filtered.end() ); }

Function Documentation

◆ core_from_string()

sysio::chain::asset core_from_string ( const std::string & s)

Definition at line 18 of file tester.cpp.

18 {
19 return sysio::chain::asset::from_string(s + " " CORE_SYMBOL_NAME);
20}
static asset from_string(const string &from)
Definition asset.cpp:31
char * s
Here is the call graph for this function:

◆ operator<<() [1/3]

std::ostream & operator<< ( std::ostream & osm,
const fc::variant & v )

Definition at line 1277 of file tester.cpp.

1277 {
1278 //fc::json::to_stream( osm, v );
1279 osm << fc::json::to_pretty_string( v );
1280 return osm;
1281}
static string to_pretty_string(const variant &v, const yield_function_t &yield, const output_formatting format=output_formatting::stringify_large_ints_and_doubles)
Definition json.cpp:775
Here is the call graph for this function:

◆ operator<<() [2/3]

std::ostream & operator<< ( std::ostream & osm,
const fc::variant_object & v )

Definition at line 1283 of file tester.cpp.

1283 {
1284 osm << fc::variant(v);
1285 return osm;
1286}

◆ operator<<() [3/3]

std::ostream & operator<< ( std::ostream & osm,
const fc::variant_object::entry & e )

Definition at line 1288 of file tester.cpp.

1288 {
1289 osm << "{ " << e.key() << ": " << e.value() << " }";
1290 return osm;
1291}
const string & key() const
const variant & value() const
Here is the call graph for this function: