add automated test for pascal string literals
This commit is contained in:
parent
ca8e6715cb
commit
74fc6d3995
|
@ -86,3 +86,5 @@ test(Exceptions.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
|||
configure_file(PascalTrap.c PascalTrapCPP.cc)
|
||||
test(PascalTrap.c PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
||||
test(${CMAKE_CURRENT_BINARY_DIR}/PascalTrapCPP.cc PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
||||
|
||||
test(PascalString.c PROPERTIES PASS_REGULAR_EXPRESSION "OK")
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#include "Test.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
const unsigned char *pstr = "\pHello, world.";
|
||||
const char *cstr = "Hello, world.";
|
||||
|
||||
if (pstr[0] != 13)
|
||||
{
|
||||
TEST_LOG_NO();
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (int i = 0; cstr[i]; ++i)
|
||||
{
|
||||
if (cstr[i] != (char) pstr[i+1])
|
||||
{
|
||||
TEST_LOG_NO();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_LOG_OK();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue