Skip to content

Commit 478001f

Browse files
committed
v1.4.0
1 parent 48307cd commit 478001f

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- Nothing yet
13+
14+
### Changed
15+
16+
- Nothing yet
17+
18+
### Fixed
19+
20+
- Nothing yet
21+
22+
## [v1.4.0](https://github.com/tbali0524/cgtest/releases/v1.4.0) - 2022-08-10
23+
24+
### Added
25+
1226
- `javascript` and `typescript` support added.
1327
- global `'runOnlyPuzzles'` option added to config file format.
1428
- Partial test cases (input files with _turn #0_ data) for all multi-turn or multi-solution CG puzzles added.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ___SPOILER ALERT:___ In the repository, there are solution source code files in
130130
## Restrictions
131131

132132
* _CGTest_ supports only solo I/O puzzles. For any test case, the input must be a fixed file (so a given line of input cannot depend on the output previously provided by the code). This means that some solo and optim puzzles cannot be tested. Bot programming is also out of question.
133-
* You can still run these puzzles (without evaluating the test result) based on the _turn #0_ input data, however your code must be modified for offline use to avoid running out of input.
133+
* You can still run these puzzles (without evaluating the test result) based on the _turn #0_ input data, however, your code must be modified for offline use to avoid running out of input or being in an endless loop.
134134

135135
* CGTest is a single thread application, so tests are running in sequence, which can be rather slow if you have lots of test cases. If you start CGTest multiple times concurrently, use separate configuration files, with different output directory settings.
136136

cgtest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// So I skipped using OOP, and - as code repetition is low - even functions.
2323
// --------------------------------------------------------------------
2424
// init counters, start global timer
25-
$version = 'v1.4.0-dev';
25+
$version = 'v1.4.0';
2626
$zeroLanguageStat = [
2727
'countLanguages' => 0,
2828
'countSkippedLanguages' => 0,
@@ -415,12 +415,13 @@
415415
$nonEmptyStringConfigKeys = ['inputPattern', 'expectedPattern', 'outputPattern'];
416416
$optionalStringConfigKeys = ['inputPath', 'expectedPath', 'outputPath', 'buildPath'];
417417
$arrayConfigKeys = ['languages', 'puzzles', 'runOnlyPuzzles'];
418+
$languageStatsSpecKeys = ['totals', 'unique'];
418419
$reservedConfigKeys = array_merge(
419420
$booleanConfigKeys,
420421
$nonEmptyStringConfigKeys,
421422
$optionalStringConfigKeys,
422423
$arrayConfigKeys,
423-
['totals', 'unique'],
424+
$languageStatsSpecKeys,
424425
);
425426
$languageNonEmptyStringConfigKeys = ['sourceExtension', 'runCommand'];
426427
$languageOptionalStringConfigKeys = ['sourcePath', 'codinGameVersion', 'versionCommand', 'buildCommand'];
@@ -896,6 +897,7 @@
896897
$sourceFullFileName = $config[$language]['sourcePath'] . $sourceFileName;
897898
$directoryStats[$config[$language]['sourcePath']] = 1;
898899
}
900+
++$languageStats[$language]['countFiles'];
899901
if (!file_exists($sourceFullFileName)) {
900902
if (!$config['clean']) {
901903
echo $warnTag . 'Cannot find sourcefile: ' . $sourceFullFileName . PHP_EOL;
@@ -907,7 +909,6 @@
907909
$puzzleStats[$puzzleName]['countSkippedFiles'] = 1;
908910
continue;
909911
}
910-
++$languageStats[$language]['countFiles'];
911912
if ($runOnlyCurrentPuzzle) {
912913
++$languageStats[$language]['countRunOnlyFiles'];
913914
if (!isset($puzzleStats[$puzzleName])) {
@@ -1253,7 +1254,10 @@
12531254
}
12541255
// --------------------------------------------------------------------
12551256
// process stats per unique puzzle
1256-
foreach ($languageStats as $stat) {
1257+
foreach ($languageStats as $language => $stat) {
1258+
if (in_array($language, $languageStatsSpecKeys, true)) {
1259+
continue;
1260+
}
12571261
foreach ($stat as $name => $count) {
12581262
if ($name == 'startTime') {
12591263
continue;

test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
php cgtest.php --verbose --stats

0 commit comments

Comments
 (0)