2017-03-05 01:09:12 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include "unittest.h"
|
|
|
|
|
|
|
|
#define EstimatedStringSize 384 // test correct page passing (>256)
|
|
|
|
|
|
|
|
static char EstimatedString[EstimatedStringSize+1]; // +1 room for terminating null
|
|
|
|
static char* EmptyTestChars=""; // strlen equivalent...
|
|
|
|
static char* TestChars="1234567890"; // we like to find numbers
|
|
|
|
|
2017-04-04 13:52:01 +00:00
|
|
|
|
2017-03-05 01:09:12 +00:00
|
|
|
TEST
|
|
|
|
{
|
|
|
|
unsigned i;
|
2022-04-17 14:07:52 +00:00
|
|
|
|
2017-03-05 01:09:12 +00:00
|
|
|
for (i=0; i < EstimatedStringSize; ++i)
|
|
|
|
EstimatedString[i] = (i%26)+'A'; // put ABCD... into the string to be estimated
|
|
|
|
|
|
|
|
ASSERT_AreEqual(strlen(EstimatedString), strcspn(EstimatedString, TestChars), "%u", "Unxpected position returned for non-participant case!");
|
|
|
|
|
|
|
|
EstimatedString[EstimatedStringSize/2] = TestChars[strlen(TestChars-1)];
|
|
|
|
ASSERT_AreEqual(EstimatedStringSize/2, strcspn(EstimatedString, TestChars), "%u", "Unxpected position returned for participant case!");
|
|
|
|
|
|
|
|
ASSERT_AreEqual(strlen(EstimatedString), strcspn(EstimatedString, EmptyTestChars), "%u", "Unxpected position returned for empty test case!");
|
|
|
|
}
|
|
|
|
ENDTEST
|