stb_cpp.cpp
This file
Path
tests/stb_cpp.cpp
83 lines · 2.2 KiB · C++
Last changed by
Merge branch 'master' into workingSean Barrettbefore adoptiond940053
History of this fileTake it
The walk stopped after 200 commits: lines older than 47685c5 point at it.
remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 1–5why, one step back1#define WIN32_MEAN_AND_LEAN2#define WIN32_LEAN_AND_MEAN3//#include <windows.h>4#include <conio.h>5#define STB_DEFINEtests: 64-bit fixes, fix typo in image testsSean Barrettbefore adoptiona28a6b1
line 6why, one step back6#ifndef _M_AMD64remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
line 7why, one step back7#define STB_NPTRtests: 64-bit fixes, fix typo in image testsSean Barrettbefore adoptiona28a6b1
line 8why, one step back8#endifremove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 9–13why, one step back9#define STB_ONLY10#include "stb.h"11//#include "stb_file.h"1213int count;Merge branch 'master' into workingSean Barrettbefore adoptiond940053
line 14why, one step back14void c(int truth, const char *error)remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 15–21why, one step back15{16 if (!truth) {17 fprintf(stderr, "Test failed: %s\n", error);18 ++count;19 }20}21Merge branch 'master' into workingSean Barrettbefore adoptiond940053
line 22why, one step back22char *expects(stb_matcher *m, char *s, int result, int len, const char *str)remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 23–33why, one step back23{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 .1Merge branch 'master' into workingSean Barrettbefore adoptiond940053
line 34why, one step back34 char *s = (char*) "tok_en5.3 20.1 20. .20.1";remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 35–55why, one step back3536 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{55 char *p;Merge branch 'master' into workingSean Barrettbefore adoptiond940053
line 56why, one step back56 p = (char*) "abcdefghijklmnopqrstuvwxyz";remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 57–60why, one step back57 c(stb_ischar('c', p), "stb_ischar 1");58 c(stb_ischar('x', p), "stb_ischar 2");59 c(!stb_ischar('#', p), "stb_ischar 3");60 c(!stb_ischar('X', p), "stb_ischar 4");Merge branch 'master' into workingSean Barrettbefore adoptiond940053
line 61why, one step back61 p = (char*) "0123456789";remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 62–65why, one step back62 c(!stb_ischar('c', p), "stb_ischar 5");63 c(!stb_ischar('x', p), "stb_ischar 6");64 c(!stb_ischar('#', p), "stb_ischar 7");65 c(!stb_ischar('X', p), "stb_ischar 8");Merge branch 'master' into workingSean Barrettbefore adoptiond940053
line 66why, one step back66 p = (char*) "#####";remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 67–70why, one step back67 c(!stb_ischar('c', p), "stb_ischar a");68 c(!stb_ischar('x', p), "stb_ischar b");69 c(stb_ischar('#', p), "stb_ischar c");70 c(!stb_ischar('X', p), "stb_ischar d");Merge branch 'master' into workingSean Barrettbefore adoptiond940053
line 71why, one step back71 p = (char*) "xXyY";remove deprecated old-precision jpg path from stb_image.hSean Barrettbefore adoption47685c5
lines 72–83why, one step back72 c(!stb_ischar('c', p), "stb_ischar e");73 c(stb_ischar('x', p), "stb_ischar f");74 c(!stb_ischar('#', p), "stb_ischar g");75 c(stb_ischar('X', p), "stb_ischar h");7677 test_lex();7879 if (count) {80 _getch();81 }82 return 0;83}