Skip to content
Myr

stb_cpp.cpp

This file

Path

tests/stb_cpp.cpp

85 lines · 2.2 KiB · C++

Last changed by

various tests and infrastructure fixesSean Barrettbefore adoption4a7a434

History of this file

Take it

The walk stopped after 200 commits: lines older than aeec66c point at it.

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 1–13why, one step back
1#define WIN32_MEAN_AND_LEAN
2#define WIN32_LEAN_AND_MEAN3//#include <windows.h>4#include <conio.h>5#define STB_DEFINE6#ifndef _M_AMD647#define STB_NPTR8#endif9#define STB_ONLY10#include "stb.h"11//#include "stb_file.h"1213int count;

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 14why, one step back
14void c(int truth, const char *error)

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 15–21why, one step back
15{
16 if (!truth) {17 fprintf(stderr, "Test failed: %s\n", error);18 ++count;19 }20}21

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 22why, one step back
22char *expects(stb_matcher *m, char *s, int result, int len, const char *str)

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 23–33why, one step back
23{
24 int res2,len2=0;25 res2 = stb_lex(m, s, &len2);26 c(result == res2 && len == len2, str);27 return s + len;28}2930void test_lex(void)31{32 stb_matcher *m = stb_lex_matcher();33 // tok_en5 .3 20.1 20. .20 .1

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 34why, one step back
34 char *s = (char*) "tok_en5.3 20.1 20. .20.1";

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 35–54why, one step back
35
36 stb_lex_item(m, "[a-zA-Z_][a-zA-Z0-9_]*", 1 );37 stb_lex_item(m, "[0-9]*\\.?[0-9]*" , 2 );38 stb_lex_item(m, "[\r\n\t ]+" , 3 );39 stb_lex_item(m, "." , -99 );40 s=expects(m,s,1,7, "stb_lex 1");41 s=expects(m,s,2,2, "stb_lex 2");42 s=expects(m,s,3,1, "stb_lex 3");43 s=expects(m,s,2,4, "stb_lex 4");44 s=expects(m,s,3,1, "stb_lex 5");45 s=expects(m,s,2,3, "stb_lex 6");46 s=expects(m,s,3,1, "stb_lex 7");47 s=expects(m,s,2,3, "stb_lex 8");48 s=expects(m,s,2,2, "stb_lex 9");49 s=expects(m,s,0,0, "stb_lex 10");50 stb_matcher_free(m);51}5253int main(int argc, char **argv)54{

various tests and infrastructure fixesSean Barrettbefore adoption4a7a434

line 55why, one step back
55#if 0

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

line 56why, one step back
56 char *p;

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 57why, one step back
57 p = (char*) "abcdefghijklmnopqrstuvwxyz";

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 58–61why, one step back
58 c(stb_ischar('c', p), "stb_ischar 1");
59 c(stb_ischar('x', p), "stb_ischar 2");60 c(!stb_ischar('#', p), "stb_ischar 3");61 c(!stb_ischar('X', p), "stb_ischar 4");

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 62why, one step back
62 p = (char*) "0123456789";

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 63–66why, one step back
63 c(!stb_ischar('c', p), "stb_ischar 5");
64 c(!stb_ischar('x', p), "stb_ischar 6");65 c(!stb_ischar('#', p), "stb_ischar 7");66 c(!stb_ischar('X', p), "stb_ischar 8");

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 67why, one step back
67 p = (char*) "#####";

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 68–71why, one step back
68 c(!stb_ischar('c', p), "stb_ischar a");
69 c(!stb_ischar('x', p), "stb_ischar b");70 c(stb_ischar('#', p), "stb_ischar c");71 c(!stb_ischar('X', p), "stb_ischar d");

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 72why, one step back
72 p = (char*) "xXyY";

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 73–76why, one step back
73 c(!stb_ischar('c', p), "stb_ischar e");
74 c(stb_ischar('x', p), "stb_ischar f");75 c(!stb_ischar('#', p), "stb_ischar g");76 c(stb_ischar('X', p), "stb_ischar h");

various tests and infrastructure fixesSean Barrettbefore adoption4a7a434

line 77why, one step back
77#endif

Merge branch 'randlong' of https://github.com/flibitijibibo/stb into workingSean Barrettbefore adoptionaeec66c

lines 78–85why, one step back
78
79 test_lex();8081 if (count) {82 _getch();83 }84 return 0;85}