Skip to content

Commit

Permalink
Merge pull request #2326 from KomodoPlatform/use-doc-marty
Browse files Browse the repository at this point in the history
update test coins
  • Loading branch information
smk762 authored Aug 7, 2023
2 parents a138024 + 867f47a commit b0f0bb8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
50 changes: 25 additions & 25 deletions src/tests/api/mm2/mm2.rpc.trade.preimage.tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace
"numer":"1"
},
"amount_rat":[[1,[1]],[1,[10000]]],
"coin":"RICK"
"coin":"DOC"
},
"taker_fee": {
"coin": "MYCOIN1",
Expand All @@ -72,7 +72,7 @@ namespace
"numer":"1"
},
"amount_rat":[[1,[1]],[1,[10000]]],
"coin":"RICK"
"coin":"DOC"
}
}
)"_json;
Expand All @@ -95,7 +95,7 @@ namespace
"numer":"0"
},
"amount_rat":[[0,[]],[1,[1]]],
"coin":"RICK"
"coin":"DOC"
}
}
}
Expand All @@ -119,7 +119,7 @@ namespace
"numer":"1"
},
"amount_rat":[[1,[1]],[1,[10000]]],
"coin":"RICK"
"coin":"DOC"
},
"taker_fee": {
"amount":"0.0001",
Expand All @@ -128,7 +128,7 @@ namespace
"numer":"1"
},
"amount_rat":[[1,[1]],[1,[10000]]],
"coin":"RICK"
"coin":"DOC"
},
"fee_to_send_taker_fee":{
Expand All @@ -138,7 +138,7 @@ namespace
"numer":"1"
},
"amount_rat":[[1,[1]],[1,[10000]]],
"coin":"RICK"
"coin":"DOC"
}
}
}
Expand All @@ -162,7 +162,7 @@ namespace
"numer":"0"
},
"amount_rat":[[0,[]],[1,[1]]],
"coin":"RICK"
"coin":"DOC"
},
"volume":"2.21363478",
"volume_fraction":{
Expand All @@ -176,7 +176,7 @@ namespace
"numer":"0"
},
"amount_rat":[[0,[]],[1,[1]]],
"coin":"RICK"
"coin":"DOC"
},
"fee_to_send_taker_fee":{
"amount":"0.00033219",
Expand Down Expand Up @@ -209,23 +209,23 @@ namespace
"numer":"0"
},
"amount_rat":[[0,[]],[1,[1]]],
"coin":"RICK"
"coin":"DOC"
}
}
})"_json;
const nlohmann::json g_preimage_request_buy_rick_morty_real = R"(
const nlohmann::json g_preimage_request_buy_DOC_MARTY_real = R"(
{
"base": "RICK",
"base": "DOC",
"method": "trade_preimage",
"rel": "MORTY",
"rel": "MARTY",
"swap_method": "buy",
"userpass": "",
"volume": "1",
"price": "1"
})"_json;
const nlohmann::json g_preimage_request_buy_rick_nonexistent_real = R"(
const nlohmann::json g_preimage_request_buy_DOC_nonexistent_real = R"(
{
"base": "RICK",
"base": "DOC",
"method": "trade_preimage",
"rel": "NONEXISTENT",
"swap_method": "buy",
Expand Down Expand Up @@ -261,7 +261,7 @@ TEST_CASE("atomic_dex::mm2::preimage_answer_success deserialization from buy")

TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites")
{
TEST_CASE("setprice BTC/RICK")
TEST_CASE("setprice BTC/DOC")
{
atomic_dex::t_trade_preimage_answer answer;
atomic_dex::mm2::from_json(g_preimage_answer_setprice, answer);
Expand All @@ -270,7 +270,7 @@ TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites")
CHECK_FALSE(answer.result.value().fee_to_send_taker_fee.has_value());
}

TEST_CASE("buy BTC/RICK")
TEST_CASE("buy BTC/DOC")
{
atomic_dex::t_trade_preimage_answer answer;
atomic_dex::mm2::from_json(g_preimage_answer_buy, answer);
Expand All @@ -279,7 +279,7 @@ TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites")
CHECK(answer.result.value().fee_to_send_taker_fee.has_value());
}

TEST_CASE("sell max BTC/RICK")
TEST_CASE("sell max BTC/DOC")
{
atomic_dex::t_trade_preimage_answer answer;
atomic_dex::mm2::from_json(g_preimage_answer_sell_max, answer);
Expand All @@ -288,7 +288,7 @@ TEST_SUITE("atomic_dex::mm2::preimage_answer deserialization test suites")
CHECK(answer.result.value().fee_to_send_taker_fee.has_value());
}

TEST_CASE("setprice ERC20 BAT/RICK")
TEST_CASE("setprice ERC20 BAT/DOC")
{
atomic_dex::t_trade_preimage_answer answer;
atomic_dex::mm2::from_json(g_preimage_answer_setprice_erc, answer);
Expand Down Expand Up @@ -371,11 +371,11 @@ SCENARIO("atomic_dex::mm2::preimage scenario")
return atomic_dex::mm2::rpc_process_answer_batch<atomic_dex::t_trade_preimage_answer>(answers[0], "trade_preimage");
};

//! A test with RICK/MORTY
GIVEN("Preparing a simple buy request RICK/MORTY")
//! A test with DOC/MARTY
GIVEN("Preparing a simple buy request DOC/MARTY")
{
//! Request values
atomic_dex::t_trade_preimage_request request{.base_coin = "RICK", .rel_coin = "MORTY", .swap_method = "buy", .volume = "1", .price = "1"};
atomic_dex::t_trade_preimage_request request{.base_coin = "DOC", .rel_coin = "MARTY", .swap_method = "buy", .volume = "1", .price = "1"};

//! Transform request into json
atomic_dex::mm2::to_json(request_json, request);
Expand All @@ -386,7 +386,7 @@ SCENARIO("atomic_dex::mm2::preimage scenario")
//! Check request without userpass against a constants at the top of the file
auto copy_request = request_json;
copy_request["userpass"] = "";
CHECK_EQ(copy_request, g_preimage_request_buy_rick_morty_real);
CHECK_EQ(copy_request, g_preimage_request_buy_DOC_MARTY_real);

//! A Test Case
WHEN("I execute the request")
Expand All @@ -403,14 +403,14 @@ SCENARIO("atomic_dex::mm2::preimage scenario")
}

//! See above
GIVEN("Preparing a wrong request RICK/NONEXISTENT coin")
GIVEN("Preparing a wrong request DOC/NONEXISTENT coin")
{
atomic_dex::t_trade_preimage_request request{.base_coin = "RICK", .rel_coin = "NONEXISTENT", .swap_method = "buy", .volume = "1"};
atomic_dex::t_trade_preimage_request request{.base_coin = "DOC", .rel_coin = "NONEXISTENT", .swap_method = "buy", .volume = "1"};
atomic_dex::mm2::to_json(request_json, request);
batch.push_back(request_json);
auto copy_request = request_json;
copy_request["userpass"] = "";
CHECK_EQ(copy_request, g_preimage_request_buy_rick_nonexistent_real);
CHECK_EQ(copy_request, g_preimage_request_buy_DOC_nonexistent_real);
WHEN("I execute the request")
{
const atomic_dex::t_trade_preimage_answer answer = generic_resp_process();
Expand Down
2 changes: 1 addition & 1 deletion src/tests/atomic.dex.tests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct tests_context : public antara::gaming::world::app
private:
std::atomic_bool m_test_context_ready{false};
std::atomic_bool m_extra_coins_ready{false};
std::vector<std::string> m_extra_coins{"RICK", "MORTY"};
std::vector<std::string> m_extra_coins{"DOC", "MARTY"};

public:
void
Expand Down

0 comments on commit b0f0bb8

Please sign in to comment.