From b0412c73b8ff129183f570a4eed72bdafd9f55d3 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 25 Oct 2016 18:41:59 +0200 Subject: Handle FillSDCardWithRandomChars command and test it Signed-off-by: Szczepan Zalega --- unittest/test2.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'unittest/test2.cc') diff --git a/unittest/test2.cc b/unittest/test2.cc index 9739217..3cfc5c1 100644 --- a/unittest/test2.cc +++ b/unittest/test2.cc @@ -31,6 +31,40 @@ void execute_password_command(Device &stick, const char *password, const char ki } +TEST_CASE("long operation test", "[test_long]") { + Stick20 stick; + bool connected = stick.connect(); + REQUIRE(connected == true); + Log::instance().set_loglevel(Loglevel::DEBUG_L2); + try{ +// execute_password_command(stick, "12345678", 'P'); + auto p = get_payload(); + p.set_defaults(); + strcpyT(p.password, "12345678"); + FillSDCardWithRandomChars::CommandTransaction::run(stick, p); + this_thread::sleep_for(1000ms); + + CHECK(false); + } + catch (LongOperationInProgressException &progressException){ + CHECK(true); + } + + + for (int i = 0; i < 30; ++i) { + try { + stick10::GetStatus::CommandTransaction::run(stick); + } + catch (LongOperationInProgressException &progressException){ + CHECK((int)progressException.progress_bar_value>=0); + CAPTURE((int)progressException.progress_bar_value); + this_thread::sleep_for(2000ms); + } + + } + +} + TEST_CASE("test", "[test]") { Stick20 stick; bool connected = stick.connect(); -- cgit v1.2.1