| 6981 | } |
| 6982 | |
| 6983 | static int test(struct ini_data *ini, const TCHAR *sections, const TCHAR *testname) |
| 6984 | { |
| 6985 | const struct cputbl *tbl = NULL; |
| 6986 | TCHAR path[1000], *vs; |
| 6987 | int v; |
| 6988 | |
| 6989 | wprintf(_T("Generating test '%s'\n"), testname); |
| 6990 | |
| 6991 | memset(exceptionenabletable, 1, sizeof(exceptionenabletable)); |
| 6992 | |
| 6993 | v = 0; |
| 6994 | ini_getvalx(ini, sections, _T("enabled"), &v); |
| 6995 | if (!v) { |
| 6996 | wprintf(_T("Test disabled\n")); |
| 6997 | return 1; |
| 6998 | } |
| 6999 | |
| 7000 | bool cpufound = false; |
| 7001 | if (ini_getstringx(ini, sections, _T("cpu"), &vs)) { |
| 7002 | TCHAR *p = vs; |
| 7003 | while (p && *p) { |
| 7004 | TCHAR *pp1 = _tcschr(p, ','); |
| 7005 | TCHAR *pp2 = _tcschr(p, '-'); |
| 7006 | if (pp1) { |
| 7007 | *pp1++ = 0; |
| 7008 | int idx = cputoindex(_tstol(p)); |
| 7009 | if (idx < 0) { |
| 7010 | wprintf(_T("Invalid CPU string '%s'\n"), vs); |
| 7011 | return 0; |
| 7012 | } |
| 7013 | if (maincpu[idx]) { |
| 7014 | cpufound = true; |
| 7015 | break; |
| 7016 | } |
| 7017 | p = pp1; |
| 7018 | } else if (pp2) { |
| 7019 | *pp2++ = 0; |
| 7020 | int idx1 = cputoindex(_tstol(p)); |
| 7021 | int idx2 = cputoindex(_tstol(pp2)); |
| 7022 | if (idx1 < 0 || idx2 < 0) { |
| 7023 | wprintf(_T("Invalid CPU string '%s'\n"), vs); |
| 7024 | return 0; |
| 7025 | } |
| 7026 | for (int i = idx1; i <= idx2; i++) { |
| 7027 | if (maincpu[i]) { |
| 7028 | cpufound = true; |
| 7029 | break; |
| 7030 | } |
| 7031 | } |
| 7032 | if (cpufound) { |
| 7033 | break; |
| 7034 | } |
| 7035 | p = pp2; |
| 7036 | } else { |
| 7037 | int idx = cputoindex(_tstol(p)); |
| 7038 | if (idx < 0) { |
| 7039 | wprintf(_T("Invalid CPU string '%s'\n"), vs); |
| 7040 | return 0; |
no test coverage detected