Skip to content
Permalink
Browse files

added llp64 fixes and fixed sse issues

  • Loading branch information...
larryk85 committed Feb 20, 2019
1 parent 4c2c6b0 commit 0de3c410b2f4057e0faa818f3e5cbfc4ef5c557f
@@ -5,6 +5,7 @@ add_test( datastream_tests ${CMAKE_BINARY_DIR}/tests/unit/datastream_tests )
add_test( fixed_bytes_tests ${CMAKE_BINARY_DIR}/tests/unit/fixed_bytes_tests )
add_test( name_tests ${CMAKE_BINARY_DIR}/tests/unit/name_tests )
add_test( rope_tests ${CMAKE_BINARY_DIR}/tests/unit/rope_tests )
add_test( print_tests ${CMAKE_BINARY_DIR}/tests/unit/print_tests )
add_test( serialize_tests ${CMAKE_BINARY_DIR}/tests/unit/serialize_tests )
add_test( symbol_tests ${CMAKE_BINARY_DIR}/tests/unit/symbol_tests )
add_test( system_tests ${CMAKE_BINARY_DIR}/tests/unit/system_tests )
@@ -11,7 +11,8 @@ add_native_executable( rope_tests rope_tests.cpp )
add_native_executable( serialize_tests serialize_tests.cpp )
add_native_executable( symbol_tests symbol_tests.cpp )
add_native_executable( system_tests system_tests.cpp )
add_native_executable(rope_tests rope_tests.cpp)
add_native_executable( rope_tests rope_tests.cpp )
add_native_executable( print_tests print_tests.cpp )
add_native_executable( time_tests time_tests.cpp )
add_native_executable( varint_tests varint_tests.cpp )

@@ -22,7 +22,7 @@ static constexpr int64_t asset_max{ asset_mask}; // 4611686018427387903

// Definitions in `eosio.cdt/libraries/eosio/asset.hpp`
EOSIO_TEST_BEGIN(asset_type_test)
silence_output(true);
silence_output(false);

static constexpr symbol s0{"A", 0};
static constexpr symbol s1{"Z", 0};
@@ -148,44 +148,44 @@ EOSIO_TEST_BEGIN(asset_type_test)
// Note:
// Uncomment once print checking has been resolved

// CHECK_PRINT( "0. SYMBOLL", [&](){asset{0LL, sym_no_prec}.print();} );
// CHECK_PRINT( "0. SYMBOLL", [&](){asset{-0LL, sym_no_prec}.print();} );
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000000 SYMBOLL", (
// [&]() {
// asset{0LL, sym_prec}.print();
// });
// )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000000 SYMBOLL", (
// [&]() {
// asset{-0LL, sym_prec}.print();
// });
// )

// CHECK_PRINT( "1. SYMBOLL", [&](){asset{1LL, sym_no_prec}.print();} );
// CHECK_PRINT( "--1. SYMBOLL", [&](){asset{-1LL, sym_no_prec}.print();} );
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000001 SYMBOLL", (
// [&]() {
// asset{1LL, sym_prec}.print();
// });
// )
// CHECK_PRINT( "-0.000000000000000000000000000000000000000000000000000000000000001 SYMBOLL", (
// [&]() {
// asset{-1LL, sym_prec}.print();
// });
// )

// CHECK_PRINT( "--4611686018427387903. SYMBOLL", [&](){asset{asset_min, sym_no_prec}.print();} );
// CHECK_PRINT( "4611686018427387903. SYMBOLL", [&](){asset{asset_max, sym_no_prec}.print();} );
// CHECK_PRINT( "-0.000000000000000000000000000000000000000000004611686018427387903 SYMBOLL", (
// [&]() {
// asset{asset_min, sym_prec}.print();
// });
// )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000004611686018427387903 SYMBOLL", (
// [&]() {
// asset{asset_max, sym_prec}.print();
// });
// )
CHECK_PRINT( "0. SYMBOLL", [&](){asset{0LL, sym_no_prec}.print();} );
CHECK_PRINT( "0. SYMBOLL", [&](){asset{-0LL, sym_no_prec}.print();} );
CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000000 SYMBOLL", (
[&]() {
asset{0LL, sym_prec}.print();
})
)
CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000000 SYMBOLL", (
[&]() {
asset{-0LL, sym_prec}.print();
})
)

CHECK_PRINT( "1. SYMBOLL", [&](){asset{1LL, sym_no_prec}.print();} );
CHECK_PRINT( "--1. SYMBOLL", [&](){asset{-1LL, sym_no_prec}.print();} );
CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000001 SYMBOLL", (
[&]() {
asset{1LL, sym_prec}.print();
})
)
CHECK_PRINT( "-0.000000000000000000000000000000000000000000000000000000000000001 SYMBOLL", (
[&]() {
asset{-1LL, sym_prec}.print();
})
)

CHECK_PRINT( "--4611686018427387903. SYMBOLL", [&](){asset{asset_min, sym_no_prec}.print();} );
CHECK_PRINT( "4611686018427387903. SYMBOLL", [&](){asset{asset_max, sym_no_prec}.print();} );
CHECK_PRINT( "-0.000000000000000000000000000000000000000000004611686018427387903 SYMBOLL", (
[&]() {
asset{asset_min, sym_prec}.print();
})
)
CHECK_PRINT( "0.000000000000000000000000000000000000000000004611686018427387903 SYMBOLL", (
[&]() {
asset{asset_max, sym_prec}.print();
})
)

for( uint8_t precision{0}; precision < 64; ++precision ) {
CHECK_EQUAL( (asset{0LL, symbol{"SYMBOLL", precision}}.to_string()),
@@ -393,43 +393,47 @@ EOSIO_TEST_BEGIN(extended_asset_type_test)
// That if there is no precision, there will be odd output:
// `extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"1"}}.print();` // output: "0. A@1"

// CHECK_PRINT( "0. A@1", [](){extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"1"}}.print();} )
// CHECK_PRINT( "0. A@5", [](){extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"5"}}.print();} )
// CHECK_PRINT( "0. Z@a", [](){extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"a"}}.print();} )
// CHECK_PRINT( "0. Z@z", [](){extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"z"}}.print();} )
CHECK_PRINT( "0. A@1", [](){extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"1"}}.print();} )
CHECK_PRINT( "0. A@5", [](){extended_asset{asset{int64_t{0}, symbol{"A", 0}}, name{"5"}}.print();} )
CHECK_PRINT( "0. Z@a", [](){extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"a"}}.print();} )
CHECK_PRINT( "0. Z@z", [](){extended_asset{asset{int64_t{0}, symbol{"Z", 0}}, name{"z"}}.print();} )

// CHECK_PRINT( "1.1 A@1", [](){extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"1"}}.print();} )
// CHECK_PRINT( "1.1 A@5", [](){extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"5"}}.print();} )
// CHECK_PRINT( "1.1 Z@a", [](){extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"a"}}.print();} )
// CHECK_PRINT( "1.1 Z@z", [](){extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"z"}}.print();} )
CHECK_PRINT( "1.1 A@1", [](){extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"1"}}.print();} )
CHECK_PRINT( "1.1 A@5", [](){extended_asset{asset{int64_t{11}, symbol{"A", 1}}, name{"5"}}.print();} )
CHECK_PRINT( "1.1 Z@a", [](){extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"a"}}.print();} )
CHECK_PRINT( "1.1 Z@z", [](){extended_asset{asset{int64_t{11}, symbol{"Z", 1}}, name{"z"}}.print();} )

// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 A@1",
// [](){extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"1"}}.print();} )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 A@5",
// [](){extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"5"}}.print();} )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 Z@a",
// [](){extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"a"}}.print();} )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 Z@z",
// [](){extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"z"}}.print();} )

// CHECK_PRINT( "0. AAAAAAA@111111111111j", [](){extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} )
// CHECK_PRINT( "0. AAAAAAA@555555555555j", [](){extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} )
// CHECK_PRINT( "0. ZZZZZZZ@aaaaaaaaaaaaj", [](){extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} )
// CHECK_PRINT( "0. ZZZZZZZ@zzzzzzzzzzzzj", [](){extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} )

// CHECK_PRINT( "1.1 AAAAAAA@111111111111j", [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} )
// CHECK_PRINT( "1.1 AAAAAAA@555555555555j", [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} )
// CHECK_PRINT( "1.1 ZZZZZZZ@aaaaaaaaaaaaj", [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} )
// CHECK_PRINT( "1.1 ZZZZZZZ@zzzzzzzzzzzzj", [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} )

// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 AAAAAAA@111111111111j",
// [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 AAAAAAA@555555555555j",
// [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 ZZZZZZZ@aaaaaaaaaaaaj",
// [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} )
// CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 ZZZZZZZ@zzzzzzzzzzzzj",
// [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} )
CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 A@1",
[](){extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"1"}}.print();} )
CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 A@5",
[](){extended_asset{asset{int64_t{11}, symbol{"A", 63}}, name{"5"}}.print();} )
CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 Z@a",
[](){extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"a"}}.print();} )
CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 Z@z",
[](){extended_asset{asset{int64_t{11}, symbol{"Z", 63}}, name{"z"}}.print();} )

CHECK_PRINT( "0. AAAAAAA@111111111111j", [](){extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} )
CHECK_PRINT( "0. AAAAAAA@555555555555j", [](){extended_asset{asset{int64_t{0}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} )
CHECK_PRINT( "0. ZZZZZZZ@aaaaaaaaaaaaj", [](){extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} )
CHECK_PRINT( "0. ZZZZZZZ@zzzzzzzzzzzzj", [](){extended_asset{asset{int64_t{0}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} )
silence_output(false);
eosio::print("WHAT\n");
extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();
eosio::print("\n");
silence_output(false);
//CHECK_PRINT( "1.1 AAAAAAA@111111111111j", [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} )
//CHECK_PRINT( "1.1 AAAAAAA@555555555555j", [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} )
//CHECK_PRINT( "1.1 ZZZZZZZ@aaaaaaaaaaaaj", [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} )
//CHECK_PRINT( "1.1 ZZZZZZZ@zzzzzzzzzzzzj", [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} )

//CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 AAAAAAA@111111111111j",
// [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"111111111111j"}}.print();} )
//CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 AAAAAAA@555555555555j",
// [](){extended_asset{asset{int64_t{11}, symbol{"AAAAAAA", 0}}, name{"555555555555j"}}.print();} )
//CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 ZZZZZZZ@aaaaaaaaaaaaj",
// [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"aaaaaaaaaaaaj"}}.print();} )
//CHECK_PRINT( "0.000000000000000000000000000000000000000000000000000000000000011 ZZZZZZZ@zzzzzzzzzzzzj",
// [](){extended_asset{asset{int64_t{11}, symbol{"ZZZZZZZ", 0}}, name{"zzzzzzzzzzzzj"}}.print();} )

// -------------------------------
// extended_asset operator-()const
@@ -83,12 +83,10 @@ EOSIO_TEST_BEGIN(datastream_test)

// T pos()const
CHECK_EQUAL( ds.pos(), datastream_buffer+256 )
CHECK_EQUAL( ds.pos(), datastream_buffer )

// inline bool seekp(size_t)
ds.seekp(0);
CHECK_EQUAL( ds.pos(), datastream_buffer )
CHECK_EQUAL( ds.pos(), datastream_buffer+256 )

// inline bool write(const char*, size_t)
fill(begin(buffer), end(buffer), 1); // Fill `buffer` with a new set of values
@@ -613,9 +611,7 @@ EOSIO_TEST_BEGIN(misc_datastream_test)
EOSIO_TEST_END

int main(int argc, char* argv[]) {
// Note:
// Uncomment once segfaulting during `memcpy` has been resolved
// EOSIO_TEST(datastream_test);
EOSIO_TEST(datastream_test);
EOSIO_TEST(datastream_specialization_test);
EOSIO_TEST(datastream_stream_test);
EOSIO_TEST(misc_datastream_test);

0 comments on commit 0de3c41

Please sign in to comment.
You can’t perform that action at this time.