One unit test was commented out
This commit is contained in:
parent
465fd9510a
commit
d4f629f183
@ -314,7 +314,7 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
{ // Create the application object in this scope
|
{ // Create the application object in this scope
|
||||||
finalcut::FApplication app{argc, argv};
|
finalcut::FApplication app{argc, argv};
|
||||||
app.setNonBlockingRead();
|
finalcut::FVTerm::setNonBlockingRead();
|
||||||
|
|
||||||
// Create a simple dialog box
|
// Create a simple dialog box
|
||||||
constexpr int iterations = 314;
|
constexpr int iterations = 314;
|
||||||
|
@ -263,7 +263,7 @@ int main (int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
// Create the application object
|
// Create the application object
|
||||||
finalcut::FApplication app {argc, argv};
|
finalcut::FApplication app {argc, argv};
|
||||||
app.setNonBlockingRead();
|
finalcut::FVTerm::setNonBlockingRead();
|
||||||
|
|
||||||
// Create main dialog object
|
// Create main dialog object
|
||||||
MainWindow main_dlg {&app};
|
MainWindow main_dlg {&app};
|
||||||
|
@ -1050,7 +1050,7 @@ int main (int argc, char* argv[])
|
|||||||
|
|
||||||
// Create the application object app
|
// Create the application object app
|
||||||
finalcut::FApplication app{argc, argv};
|
finalcut::FApplication app{argc, argv};
|
||||||
app.setNonBlockingRead();
|
finalcut::FVTerm::setNonBlockingRead();
|
||||||
|
|
||||||
// Create main dialog object d
|
// Create main dialog object d
|
||||||
MyDialog d{&app};
|
MyDialog d{&app};
|
||||||
|
@ -532,7 +532,7 @@ long FString::toLong() const
|
|||||||
if ( neg )
|
if ( neg )
|
||||||
num = (~num) + 1;
|
num = (~num) + 1;
|
||||||
|
|
||||||
return static_cast<long>(num);
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@ -576,7 +576,7 @@ uLong FString::toULong() const
|
|||||||
if ( *p != L'\0' && ! std::iswdigit(std::wint_t(*p)) )
|
if ( *p != L'\0' && ! std::iswdigit(std::wint_t(*p)) )
|
||||||
throw std::invalid_argument ("no valid number");
|
throw std::invalid_argument ("no valid number");
|
||||||
|
|
||||||
return static_cast<uLong>(num);
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -153,7 +153,7 @@ FTermcap::Status FTermcap::paddingPrint ( const std::string& string
|
|||||||
++iter;
|
++iter;
|
||||||
const auto first_digit = iter;
|
const auto first_digit = iter;
|
||||||
|
|
||||||
if ( (! std::isdigit(int(*iter)) && *iter != '.') )
|
if ( ! std::isdigit(int(*iter)) && *iter != '.' )
|
||||||
{
|
{
|
||||||
outc(int('$'));
|
outc(int('$'));
|
||||||
outc(int('<'));
|
outc(int('<'));
|
||||||
|
@ -326,11 +326,11 @@ class FVTerm
|
|||||||
|
|
||||||
struct TermString
|
struct TermString
|
||||||
{
|
{
|
||||||
TermString (const std::wstring& wstr)
|
explicit TermString (const std::wstring& wstr)
|
||||||
: wstring{wstr}
|
: wstring{wstr}
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TermString (const std::string& str)
|
explicit TermString (const std::string& str)
|
||||||
: string{str}
|
: string{str}
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class FTermcapTest : public CPPUNIT_NS::TestFixture
|
|||||||
CPPUNIT_TEST (getStringTest);
|
CPPUNIT_TEST (getStringTest);
|
||||||
CPPUNIT_TEST (encodeMotionParameterTest);
|
CPPUNIT_TEST (encodeMotionParameterTest);
|
||||||
CPPUNIT_TEST (encodeParameterTest);
|
CPPUNIT_TEST (encodeParameterTest);
|
||||||
//CPPUNIT_TEST (paddingPrintTest);
|
CPPUNIT_TEST (paddingPrintTest);
|
||||||
|
|
||||||
// End of test suite definition
|
// End of test suite definition
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
@ -255,22 +255,32 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
CPPUNIT_ASSERT ( tcap.isInitialized() );
|
CPPUNIT_ASSERT ( tcap.isInitialized() );
|
||||||
CPPUNIT_ASSERT ( tcap.no_padding_char );
|
CPPUNIT_ASSERT ( tcap.no_padding_char );
|
||||||
|
|
||||||
|
// With an empty string
|
||||||
|
CPPUNIT_ASSERT ( output.empty() );
|
||||||
|
auto status = tcap.paddingPrint ({}, 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::Error );
|
||||||
|
CPPUNIT_ASSERT ( output.empty() );
|
||||||
|
CPPUNIT_ASSERT ( output == "" );
|
||||||
|
|
||||||
// '$' without '<'
|
// '$' without '<'
|
||||||
CPPUNIT_ASSERT ( output.empty() );
|
CPPUNIT_ASSERT ( output.empty() );
|
||||||
tcap.paddingPrint ("12$34567", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("12$34567", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( ! output.empty() );
|
CPPUNIT_ASSERT ( ! output.empty() );
|
||||||
CPPUNIT_ASSERT ( output == "12$34567" );
|
CPPUNIT_ASSERT ( output == "12$34567" );
|
||||||
|
|
||||||
// No closing '>'
|
// No closing '>'
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("12$3$<4567", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("12$3$<4567", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( ! output.empty() );
|
CPPUNIT_ASSERT ( ! output.empty() );
|
||||||
CPPUNIT_ASSERT ( output == "12$3$<4567" );
|
CPPUNIT_ASSERT ( output == "12$3$<4567" );
|
||||||
|
|
||||||
// With 2 ms print delay
|
// With 2 ms print delay
|
||||||
output.clear();
|
output.clear();
|
||||||
auto start = high_resolution_clock::now();
|
auto start = high_resolution_clock::now();
|
||||||
tcap.paddingPrint ("1234$<2/>567", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("1234$<2/>567", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
auto end = high_resolution_clock::now();
|
auto end = high_resolution_clock::now();
|
||||||
auto duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
auto duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
||||||
CPPUNIT_ASSERT ( duration_ms >= 2 );
|
CPPUNIT_ASSERT ( duration_ms >= 2 );
|
||||||
@ -280,7 +290,8 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
// With 20 ms print delay
|
// With 20 ms print delay
|
||||||
output.clear();
|
output.clear();
|
||||||
start = high_resolution_clock::now();
|
start = high_resolution_clock::now();
|
||||||
tcap.paddingPrint ("12$3$<45$<20/>67", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("12$3$<45$<20/>67", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
end = high_resolution_clock::now();
|
end = high_resolution_clock::now();
|
||||||
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
||||||
CPPUNIT_ASSERT ( duration_ms >= 20 );
|
CPPUNIT_ASSERT ( duration_ms >= 20 );
|
||||||
@ -290,7 +301,8 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
// With a high a delay (9.999 seconds)
|
// With a high a delay (9.999 seconds)
|
||||||
output.clear();
|
output.clear();
|
||||||
start = high_resolution_clock::now();
|
start = high_resolution_clock::now();
|
||||||
tcap.paddingPrint ("1234$<9999/>567", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("1234$<9999/>567", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
end = high_resolution_clock::now();
|
end = high_resolution_clock::now();
|
||||||
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
||||||
CPPUNIT_ASSERT ( duration_ms >= 9999 );
|
CPPUNIT_ASSERT ( duration_ms >= 9999 );
|
||||||
@ -300,7 +312,8 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
// With too high a delay (delay > 9999 ms = 9.999 sec)
|
// With too high a delay (delay > 9999 ms = 9.999 sec)
|
||||||
output.clear();
|
output.clear();
|
||||||
start = high_resolution_clock::now();
|
start = high_resolution_clock::now();
|
||||||
tcap.paddingPrint ("1234$<10000>567", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("1234$<10000>567", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
end = high_resolution_clock::now();
|
end = high_resolution_clock::now();
|
||||||
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
||||||
CPPUNIT_ASSERT ( duration_ms < 20 );
|
CPPUNIT_ASSERT ( duration_ms < 20 );
|
||||||
@ -309,14 +322,16 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
|
|
||||||
// Beep has delayed output and flush
|
// Beep has delayed output and flush
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint (TCAP(t_bell), 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint (TCAP(t_bell), 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( ! output.empty() );
|
CPPUNIT_ASSERT ( ! output.empty() );
|
||||||
CPPUNIT_ASSERT ( output == std::string(TCAP(t_bell)) );
|
CPPUNIT_ASSERT ( output == std::string(TCAP(t_bell)) );
|
||||||
|
|
||||||
// Flash screen has delayed output and flush
|
// Flash screen has delayed output and flush
|
||||||
output.clear();
|
output.clear();
|
||||||
start = high_resolution_clock::now();
|
start = high_resolution_clock::now();
|
||||||
tcap.paddingPrint ("\033[?5h$<100/>\033[?5l", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("\033[?5h$<100/>\033[?5l", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
end = high_resolution_clock::now();
|
end = high_resolution_clock::now();
|
||||||
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
duration_ms = int(duration_cast<milliseconds>(end - start).count());
|
||||||
CPPUNIT_ASSERT ( duration_ms >= 100 );
|
CPPUNIT_ASSERT ( duration_ms >= 100 );
|
||||||
@ -331,7 +346,8 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
CPPUNIT_ASSERT ( ! tcap.xon_xoff_flow_control );
|
CPPUNIT_ASSERT ( ! tcap.xon_xoff_flow_control );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.setBaudrate (38400);
|
tcap.setBaudrate (38400);
|
||||||
tcap.paddingPrint ("1234$<5*/>567", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("1234$<5*/>567", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
const auto& str1_with_0 = "1234" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "567";
|
const auto& str1_with_0 = "1234" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "567";
|
||||||
std::string target_output(std::begin(str1_with_0), std::end(str1_with_0) - 1);
|
std::string target_output(std::begin(str1_with_0), std::end(str1_with_0) - 1);
|
||||||
CPPUNIT_ASSERT ( ! output.empty() );
|
CPPUNIT_ASSERT ( ! output.empty() );
|
||||||
@ -342,108 +358,130 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
output.clear();
|
output.clear();
|
||||||
tcap.setBaudrate (9600);
|
tcap.setBaudrate (9600);
|
||||||
tcap.padding_baudrate = 0; // no padding baudrate
|
tcap.padding_baudrate = 0; // no padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 6 );
|
CPPUNIT_ASSERT ( output.length() == 6 );
|
||||||
CPPUNIT_ASSERT ( output == "abcdef" );
|
CPPUNIT_ASSERT ( output == "abcdef" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2*/>def", 1, FTermcapTest::putchar_test); // with "*/"
|
status = tcap.paddingPrint ("abc$<2*/>def", 1, FTermcapTest::putchar_test); // with "*/"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
const auto& str2_with_0 = "abc" "\0\0" "def";
|
const auto& str2_with_0 = "abc" "\0\0" "def";
|
||||||
target_output = std::string(std::begin(str2_with_0), std::end(str2_with_0) - 1);
|
target_output = std::string(std::begin(str2_with_0), std::end(str2_with_0) - 1);
|
||||||
CPPUNIT_ASSERT ( output.length() == 8 );
|
CPPUNIT_ASSERT ( output.length() == 8 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2/*>def", 1, FTermcapTest::putchar_test); // with "/*"
|
status = tcap.paddingPrint ("abc$<2/*>def", 1, FTermcapTest::putchar_test); // with "/*"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 8 );
|
CPPUNIT_ASSERT ( output.length() == 8 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2/x*>def", 1, FTermcapTest::putchar_test); // defekt
|
status = tcap.paddingPrint ("abc$<2/x*>def", 1, FTermcapTest::putchar_test); // defekt
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 13 );
|
CPPUNIT_ASSERT ( output.length() == 13 );
|
||||||
CPPUNIT_ASSERT ( output == "abc$<2/x*>def" );
|
CPPUNIT_ASSERT ( output == "abc$<2/x*>def" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2/*x>def", 1, FTermcapTest::putchar_test); // defekt
|
status = tcap.paddingPrint ("abc$<2/*x>def", 1, FTermcapTest::putchar_test); // defekt
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 13 );
|
CPPUNIT_ASSERT ( output.length() == 13 );
|
||||||
CPPUNIT_ASSERT ( output == "abc$<2/*x>def" );
|
CPPUNIT_ASSERT ( output == "abc$<2/*x>def" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 19200; // baudrate < padding baudrate
|
tcap.padding_baudrate = 19200; // baudrate < padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 6 );
|
CPPUNIT_ASSERT ( output.length() == 6 );
|
||||||
CPPUNIT_ASSERT ( output == "abcdef" );
|
CPPUNIT_ASSERT ( output == "abcdef" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2*/>def", 1, FTermcapTest::putchar_test); // with "*/"
|
status = tcap.paddingPrint ("abc$<2*/>def", 1, FTermcapTest::putchar_test); // with "*/"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 8 );
|
CPPUNIT_ASSERT ( output.length() == 8 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 9600; // baudrate >= padding baudrate
|
tcap.padding_baudrate = 9600; // baudrate >= padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 1, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 1, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 8 );
|
CPPUNIT_ASSERT ( output.length() == 8 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
|
|
||||||
// Wait 2 ms with padding characters and with 2 affected line
|
// Wait 2 ms with padding characters and with 2 affected line
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 0; // no padding baudrate
|
tcap.padding_baudrate = 0; // no padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>>def", 2, FTermcapTest::putchar_test); // double >>
|
status = tcap.paddingPrint ("abc$<2*>>def", 2, FTermcapTest::putchar_test); // double >>
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 7 );
|
CPPUNIT_ASSERT ( output.length() == 7 );
|
||||||
CPPUNIT_ASSERT ( output == "abc>def" );
|
CPPUNIT_ASSERT ( output == "abc>def" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2*/>def", 2, FTermcapTest::putchar_test); // with "*/"
|
status = tcap.paddingPrint ("abc$<2*/>def", 2, FTermcapTest::putchar_test); // with "*/"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
const auto& str3_with_0 = "abc" "\0\0\0\0" "def";
|
const auto& str3_with_0 = "abc" "\0\0\0\0" "def";
|
||||||
target_output = std::string(std::begin(str3_with_0), std::end(str3_with_0) - 1);
|
target_output = std::string(std::begin(str3_with_0), std::end(str3_with_0) - 1);
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2/*>def", 2, FTermcapTest::putchar_test); // with "/*"
|
status = tcap.paddingPrint ("abc$<2/*>def", 2, FTermcapTest::putchar_test); // with "/*"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 19200; // baudrate < padding baudrate
|
tcap.padding_baudrate = 19200; // baudrate < padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 2, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 2, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 6 );
|
CPPUNIT_ASSERT ( output.length() == 6 );
|
||||||
CPPUNIT_ASSERT ( output == "abcdef" );
|
CPPUNIT_ASSERT ( output == "abcdef" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2*/>def", 2, FTermcapTest::putchar_test); // with "*/"
|
status = tcap.paddingPrint ("abc$<2*/>def", 2, FTermcapTest::putchar_test); // with "*/"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2/*>def", 2, FTermcapTest::putchar_test); // with "/*"
|
status = tcap.paddingPrint ("abc$<2/*>def", 2, FTermcapTest::putchar_test); // with "/*"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 9600; // baudrate >= padding baudrate
|
tcap.padding_baudrate = 9600; // baudrate >= padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 2, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 2, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
|
|
||||||
// Wait 2 ms with padding characters and with 3 affected line
|
// Wait 2 ms with padding characters and with 3 affected line
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 0; // no padding baudrate
|
tcap.padding_baudrate = 0; // no padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 3, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 3, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output == "abcdef" );
|
CPPUNIT_ASSERT ( output == "abcdef" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2*/>def", 3, FTermcapTest::putchar_test); // with "*/"
|
status = tcap.paddingPrint ("abc$<2*/>def", 3, FTermcapTest::putchar_test); // with "*/"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
const auto& str4_with_0 = "abc" "\0\0\0\0\0\0" "def";
|
const auto& str4_with_0 = "abc" "\0\0\0\0\0\0" "def";
|
||||||
target_output = std::string(std::begin(str4_with_0), std::end(str4_with_0) - 1);
|
target_output = std::string(std::begin(str4_with_0), std::end(str4_with_0) - 1);
|
||||||
CPPUNIT_ASSERT ( output.length() == 12 );
|
CPPUNIT_ASSERT ( output.length() == 12 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2/*>def", 3, FTermcapTest::putchar_test); // with "/*"
|
status = tcap.paddingPrint ("abc$<2/*>def", 3, FTermcapTest::putchar_test); // with "/*"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 12 );
|
CPPUNIT_ASSERT ( output.length() == 12 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 19200; // baudrate < padding baudrate
|
tcap.padding_baudrate = 19200; // baudrate < padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 3, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 3, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 6 );
|
CPPUNIT_ASSERT ( output.length() == 6 );
|
||||||
CPPUNIT_ASSERT ( output == "abcdef" );
|
CPPUNIT_ASSERT ( output == "abcdef" );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2*/>def", 3, FTermcapTest::putchar_test); // with "*/"
|
status = tcap.paddingPrint ("abc$<2*/>def", 3, FTermcapTest::putchar_test); // with "*/"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 12 );
|
CPPUNIT_ASSERT ( output.length() == 12 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2/*>def", 3, FTermcapTest::putchar_test); // with "/*"
|
status = tcap.paddingPrint ("abc$<2/*>def", 3, FTermcapTest::putchar_test); // with "/*"
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 12 );
|
CPPUNIT_ASSERT ( output.length() == 12 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.padding_baudrate = 9600; // baudrate >= padding baudrate
|
tcap.padding_baudrate = 9600; // baudrate >= padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2*>def", 3, FTermcapTest::putchar_test);
|
status = tcap.paddingPrint ("abc$<2*>def", 3, FTermcapTest::putchar_test);
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 12 );
|
CPPUNIT_ASSERT ( output.length() == 12 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
|
|
||||||
@ -451,21 +489,25 @@ void FTermcapTest::paddingPrintTest()
|
|||||||
output.clear();
|
output.clear();
|
||||||
tcap.setBaudrate(19200);
|
tcap.setBaudrate(19200);
|
||||||
tcap.padding_baudrate = 19200; // baudrate == padding baudrate
|
tcap.padding_baudrate = 19200; // baudrate == padding baudrate
|
||||||
tcap.paddingPrint ("abc$<2.>def", 1, FTermcapTest::putchar_test); // 2.
|
status = tcap.paddingPrint ("abc$<2.>def", 1, FTermcapTest::putchar_test); // 2.
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
const auto& str5_with_0 = "abc" "\0\0\0\0" "def";
|
const auto& str5_with_0 = "abc" "\0\0\0\0" "def";
|
||||||
target_output = std::string(std::begin(str5_with_0), std::end(str5_with_0) - 1);
|
target_output = std::string(std::begin(str5_with_0), std::end(str5_with_0) - 1);
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2.0>def", 1, FTermcapTest::putchar_test); // 2.0
|
status = tcap.paddingPrint ("abc$<2.0>def", 1, FTermcapTest::putchar_test); // 2.0
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2.7>def", 1, FTermcapTest::putchar_test); // 2.7
|
status = tcap.paddingPrint ("abc$<2.7>def", 1, FTermcapTest::putchar_test); // 2.7
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
output.clear();
|
output.clear();
|
||||||
tcap.paddingPrint ("abc$<2.77>def", 1, FTermcapTest::putchar_test); // 2.77
|
status = tcap.paddingPrint ("abc$<2.77>def", 1, FTermcapTest::putchar_test); // 2.77
|
||||||
|
CPPUNIT_ASSERT ( status == finalcut::FTermcap::Status::OK );
|
||||||
CPPUNIT_ASSERT ( output.length() == 10 );
|
CPPUNIT_ASSERT ( output.length() == 10 );
|
||||||
CPPUNIT_ASSERT ( output == target_output );
|
CPPUNIT_ASSERT ( output == target_output );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user