]> git.sur5r.net Git - cc65/blob - test/val/lib_common_strcspn.c
Removed workaround.
[cc65] / test / val / lib_common_strcspn.c
1 #include <string.h>
2 #include "unittest.h"
3
4 #define EstimatedStringSize 384                         // test correct page passing (>256)
5
6 static char EstimatedString[EstimatedStringSize+1];     // +1 room for terminating null
7 static char* EmptyTestChars="";                         // strlen equivalent...
8 static char* TestChars="1234567890";                    // we like to find numbers
9
10
11 TEST
12 {
13     unsigned i;
14     
15     for (i=0; i < EstimatedStringSize; ++i)
16       EstimatedString[i] = (i%26)+'A';                 // put ABCD... into the string to be estimated
17
18     ASSERT_AreEqual(strlen(EstimatedString), strcspn(EstimatedString, TestChars), "%u", "Unxpected position returned for non-participant case!");
19
20     EstimatedString[EstimatedStringSize/2] = TestChars[strlen(TestChars-1)];
21     ASSERT_AreEqual(EstimatedStringSize/2, strcspn(EstimatedString, TestChars), "%u", "Unxpected position returned for participant case!");
22
23     ASSERT_AreEqual(strlen(EstimatedString), strcspn(EstimatedString, EmptyTestChars), "%u", "Unxpected position returned for empty test case!");
24 }
25 ENDTEST