Remove dead code

This commit is contained in:
Markus Gans 2018-09-15 02:25:30 +02:00
parent 103b4b3681
commit 5543157de5
4 changed files with 53 additions and 142 deletions

View File

@ -83,7 +83,7 @@ class FOptiAttrTest : public CPPUNIT_NS::TestFixture
void wyse50Test(); void wyse50Test();
private: private:
std::string printSequence (char*); std::string printSequence (const std::string&);
// Adds code needed to register the test suite // Adds code needed to register the test suite
CPPUNIT_TEST_SUITE (FOptiAttrTest); CPPUNIT_TEST_SUITE (FOptiAttrTest);
@ -4483,57 +4483,31 @@ void FOptiAttrTest::wyse50Test()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::string FOptiAttrTest::printSequence (char* str) std::string FOptiAttrTest::printSequence (const std::string& s)
{ {
std::ostringstream sequence; std::string sequence;
const std::string ctrl_character[] =
if ( ! str ) {
return ""; "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "Tab", "LF", "VT", "FF", "CR", "SO", "SI",
const std::string& s(str); "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
"CAN", "EM", "SUB", "Esc", "FS", "GS", "RS", "US",
"Space"
};
for (std::string::size_type i = 0; i < s.length(); ++i) for (std::string::size_type i = 0; i < s.length(); ++i)
{ {
switch ( int(s[i]) ) char ch = s[i];
{
case 0x03:
sequence << "ETX ";
break;
case 0x08: if ( ch < 0x21 )
sequence << "BS "; sequence += ctrl_character[uInt(ch)];
break; else
sequence += ch;
case 0x09: sequence += ' ';
sequence << "Tab ";
break;
case 0x0a:
sequence << "LF ";
break;
case 0x0d:
sequence << "CR ";
break;
case 0x0e:
sequence << "SO ";
break;
case 0x0f:
sequence << "SI ";
break;
case 0x1b:
sequence << "Esc ";
break;
default:
sequence << s[i] << ' ';
}
} }
return sequence.str(); return sequence;
} }

View File

@ -736,39 +736,29 @@ void FOptiMoveTest::wyse50Test()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::string FOptiMoveTest::printSequence (const std::string& s) std::string FOptiMoveTest::printSequence (const std::string& s)
{ {
std::ostringstream sequence; std::string sequence;
const std::string ctrl_character[] =
{
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "Tab", "LF", "VT", "FF", "CR", "SO", "SI",
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
"CAN", "EM", "SUB", "Esc", "FS", "GS", "RS", "US",
"Space"
};
for (std::string::size_type i = 0; i < s.length(); ++i) for (std::string::size_type i = 0; i < s.length(); ++i)
{ {
switch ( int(s[i]) ) char ch = s[i];
{
case 0x08:
sequence << "BS ";
break;
case 0x09: if ( ch < 0x21 )
sequence << "TAB "; sequence += ctrl_character[uInt(ch)];
break; else
sequence += ch;
case 0x0a: sequence += ' ';
sequence << "LF ";
break;
case 0x0d:
sequence << "CR ";
break;
case 0x1b:
sequence << "Esc ";
break;
default:
sequence << s[i];
sequence << ' ';
}
} }
return sequence.str(); return sequence;
} }
// Put the test suite in the registry // Put the test suite in the registry

View File

@ -284,6 +284,8 @@ void FTermcapQuirksTest::generalTest()
, C_STR(CSI "9m") ); , C_STR(CSI "9m") );
CPPUNIT_ASSERT_CSTRING ( caps[fc::t_exit_crossed_out_mode].string CPPUNIT_ASSERT_CSTRING ( caps[fc::t_exit_crossed_out_mode].string
, C_STR(CSI "29m") ); , C_STR(CSI "29m") );
CPPUNIT_ASSERT_CSTRING ( printSequence(caps[fc::t_enter_ca_mode].string).c_str()
, C_STR("Esc 7 Esc [ ? 4 7 h ") );
delete[] caps; delete[] caps;
} }
@ -710,39 +712,29 @@ void FTermcapQuirksTest::screenTest()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
std::string FTermcapQuirksTest::printSequence (const std::string& s) std::string FTermcapQuirksTest::printSequence (const std::string& s)
{ {
std::ostringstream sequence; std::string sequence;
const std::string ctrl_character[] =
{
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "Tab", "LF", "VT", "FF", "CR", "SO", "SI",
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
"CAN", "EM", "SUB", "Esc", "FS", "GS", "RS", "US",
"Space"
};
for (std::string::size_type i = 0; i < s.length(); ++i) for (std::string::size_type i = 0; i < s.length(); ++i)
{ {
switch ( int(s[i]) ) char ch = s[i];
{
case 0x08:
sequence << "BS ";
break;
case 0x09: if ( ch < 0x21 )
sequence << "TAB "; sequence += ctrl_character[uInt(ch)];
break; else
sequence += ch;
case 0x0a: sequence += ' ';
sequence << "LF ";
break;
case 0x0d:
sequence << "CR ";
break;
case 0x1b:
sequence << "Esc ";
break;
default:
sequence << s[i];
sequence << ' ';
}
} }
return sequence.str(); return sequence;
} }
// Put the test suite in the registry // Put the test suite in the registry

View File

@ -32,8 +32,6 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/mman.h> #include <sys/mman.h>
#define CPPUNIT_ASSERT_CSTRING(expected, actual) \
check_c_string (expected, actual, CPPUNIT_SOURCELINE())
static char* colorname[] = static char* colorname[] =
{ {
@ -296,20 +294,6 @@ static char* colorname[] =
0 0
}; };
//----------------------------------------------------------------------
void check_c_string ( const char* s1
, const char* s2
, CppUnit::SourceLine sourceLine )
{
if ( s1 == 0 && s2 == 0 ) // Strings are equal
return;
if ( s1 && s2 && std::strcmp (s1, s2) == 0 ) // Strings are equal
return;
::CppUnit::Asserter::fail ("Strings are not equal", sourceLine);
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class FTermDetectionTest // class FTermDetectionTest
@ -371,7 +355,6 @@ class FTermDetectionTest : public CPPUNIT_NS::TestFixture
void tmuxTest(); void tmuxTest();
private: private:
std::string printSequence (const std::string&);
char* getAnswerback (console); char* getAnswerback (console);
char* getDSR (console); char* getDSR (console);
char* getDECID (console); char* getDECID (console);
@ -804,7 +787,7 @@ void FTermDetectionTest::puttyTest()
CPPUNIT_ASSERT ( detect.hasTerminalDetection() ); CPPUNIT_ASSERT ( detect.hasTerminalDetection() );
CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() ); CPPUNIT_ASSERT ( ! detect.hasSetCursorStyleSupport() );
//debug = true; debug = true;
debugOutput(); debugOutput();
closeStandardStreams(); closeStandardStreams();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
@ -1591,34 +1574,6 @@ void FTermDetectionTest::tmuxTest()
// private methods of FOptiMoveTest // private methods of FOptiMoveTest
//----------------------------------------------------------------------
std::string FTermDetectionTest::printSequence (const std::string& s)
{
std::string sequence;
const std::string ctrl_character[] =
{
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
"BS", "Tab", "LF", "VT", "FF", "CR", "SO", "SI",
"DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB",
"CAN", "EM", "SUB", "Esc", "FS", "GS", "RS", "US",
"Space"
};
for (std::string::size_type i = 0; i < s.length(); ++i)
{
char ch = buffer[i];
if ( ch < 0x21 )
sequence += ctrl_character[uInt(ch)];
else
sequence += ch;
sequence += ' ';
}
return sequence;
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
char* FTermDetectionTest::getAnswerback (console con) char* FTermDetectionTest::getAnswerback (console con)
{ {