Skip to content

Commit ac9618b

Browse files
committed
v1.3.0
1 parent fa21b73 commit ac9618b

File tree

6 files changed

+49
-21
lines changed

6 files changed

+49
-21
lines changed

.cgtest.full.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
'scala',
6262
// 'swift',
6363
// 'typescript',
64-
// 'vb.net',
64+
'vb.net',
6565
// Additional languages, unsupported on CodinGame:
6666
// 'cobol',
6767
// 'fortran',

.cgtest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
'scala',
6262
// 'swift',
6363
// 'typescript',
64-
// 'vb.net',
64+
'vb.net',
6565
// Additional languages, unsupported on CodinGame:
6666
// 'cobol',
6767
'fortran',

CHANGELOG.md

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

1010
### Added
1111

12-
- `c#` support added.
12+
- Nothing yet.
13+
14+
### Changed
15+
16+
- Nothing yet.
17+
18+
### Fixed
19+
20+
- Nothing yet.
21+
22+
## [v1.3.0](https://github.com/tbali0524/cgtest/releases/v1.3.0) - 2022-08-05
23+
24+
### Added
25+
26+
- `c#` and `vb.net` support added.
1327
- `'--run-only'` command-line argument added.
1428
- `'run-only'` global option added to config file format.
1529
- `'runOnlyPuzzles'` language-specific option added to config file format.
1630
- `'buildPath'` global option added to config file format.
17-
- _turn #0_ input files added for several optimization puzzles.
31+
- partial test cases (input files with _turn #0_ data) added for several optimization and multi-turn solo puzzles.
1832

1933
### Changed
2034

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A multi-language offline batch test runner for `CodinGame` (or other) solo I/O p
88

99
__CGTest__ is a simple command-line tool to run tests in batch mode using your local dev and runtime environments. With a single command, you can run hundreds of tests for your code, even if written in __multiple languages__, for __multiple puzzles__ (or projects), and for __multiple test cases__ per puzzle.
1010

11-
CGTest was successfully used for running `c`, `c#`, `c++`, `d`, `dart`, `f#`, `fortran`, `go`, `groovy`, `haskell`, `java`, `kotlin`, `lua`, `pascal`, `perl`, `php`, `python`, `ruby`, `rust` and `scala` tests both in Windows and in Linux; and additionally `bash` and `ocaml` in Linux. It should also work on almost any other computer system, including Mac.
11+
CGTest was successfully used for running `c`, `c#`, `c++`, `d`, `dart`, `f#`, `fortran`, `go`, `groovy`, `haskell`, `java`, `kotlin`, `lua`, `pascal`, `perl`, `php`, `python`, `ruby`, `rust`, `scala` and `vb.net` tests both in Windows and in Linux, and additionally `bash` and `ocaml` in Linux. It should also work on almost any other computer system, including Mac.
1212

1313
The test runner works for any non-interactive code that reads from a standard input stream, and writes the result to the standard output stream. Using it for CodinGame puzzles is only one possible use case.
1414

@@ -103,7 +103,7 @@ Some settings (but not all) can be also overriden via command-line arguments. If
103103
* By default, all source code is expected to be in the respective `languageName/` directory, with the same name as the beginning of the test case input data file name.
104104
* If using _per-puzzle_ directories for the test cases, you must set the per-language `'sourcePath'` setting to `''` in the config file.)
105105
* If not provided via command-line, list the puzzle names in the config file either in the global `'puzzles'` section, or in a per-language `'includePuzzles'` list. If you have solution for a puzzle in most (but not all) languages, you can list it in the global puzzles section, but add also add to the per-language `'excludePuzzles'` lists for languages that you lack the solution.
106-
* You can also add a puzzle to a per-language `'runOnlyPuzzles'` list in the config file. These puzzles will be built and run, but the tests will always pass, without evaluating the test results.
106+
* You can also add a puzzle to a per-language `'runOnlyPuzzles'` list in the config file. These puzzles will be built and run, but the tests will always pass, without evaluating the test results. This is useful to run some _optimization_ and _multi-turn_ puzzles on CodinGame.
107107
* You can change the directory structure and the file naming conventions that `CGTest` is using out of the box. However, you will need to tweak the config file a bit to your liking. For more details, check out the comments in the sample config file.
108108

109109
### Important
@@ -125,21 +125,24 @@ ___SPOILER ALERT:___ In the repository, there are solution source code files in
125125
* This has references to ALL the test cases included in the CGTest repository.
126126
* Some puzzles are listed in the global `'puzzles'` section. These are the shortest and simplest puzzles, so they are especially well-suited if you want to solve some puzzles in __all the CG-supported languages__.
127127
* Other puzzles are listed in a per-language `'includePuzzles'` or `'runOnlyPuzzles'` section. Modify the language and comment out the puzzle names as needed.
128-
* For most puzzles currently only a single test case is provided. That is OK for a simple smoke-test, but not to prove that your solution is correct.
128+
* For most puzzles, currently only a single test case is provided. That is OK for a simple smoke-test, but not enough to prove that your solution is really correct.
129129

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+
* The `run-only` configuration can be used to run these puzzles based on _turn #0_ input data, however your code must be modified for offline use to avoid running out of input.
133134

134135
* 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.
135136

136137
* CGTest does not use containers or any other environment separation when running your tests. If your code does silly things, like deleting files, then CGTest will NOT prevent it doing the damage.
137138

139+
* Building `C#` or `VB.NET` source code generates lots of files in the `.tests/temp/bin` and `.tests/temp/obj` directories. CGTest does not delete these directories with the `--clean` command-line option.
140+
138141
## Known issues
139142

140143
I don't have local dev environment for all the 27 languages Codingame supports. Therefore, some of the languages default settings are not properly set up. You need to create a section for these languages in the config file.
141144

142-
* I could not yet set up to run the tester properly for: `vb.net`, `clojure`, `objective-c`, `swift`
145+
* I could not yet set up to run the tester properly for: `clojure`, `objective-c`, `swift`
143146
* `javascript` and `typescript` code is run by `node`, however the `readline()` function is missing. I don't know how to properly polyfill this locally.
144147
* Running `bash` script works in WSL or in Linux, but I ran into issues with vanilla Windows using a _'bash for Windows'_ package such as `MSYS2`.
145148

cgtest.php

Lines changed: 24 additions & 13 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.3.0-dev';
25+
$version = 'v1.3.0';
2626
$zeroLanguageStat = [
2727
'countLanguages' => 0,
2828
'countDirectories' => 0,
@@ -71,6 +71,9 @@
7171
// --------------------------------------------------------------------
7272
// default configuration
7373
$defaultConfigFileName = '.cgtest.php';
74+
$csprojExtension = '.csproj';
75+
$vbprojExtension = '.vbproj';
76+
$vbProjectName = 'vb_project';
7477
$defaultConfig = [
7578
'dry-run' => false,
7679
'run-only' => false,
@@ -114,10 +117,11 @@
114117
'sourceExtension' => '.cs',
115118
'codinGameVersion' => '.NET Core 3.1.201',
116119
'versionCommand' => 'dotnet --version',
117-
'buildCommand' => 'dotnet publish %b%p.csproj -o %b --nologo --use-current-runtime --sc -v:q',
118-
'runCommand' => (PHP_OS_FAMILY == 'Windows' ? '%b%p.exe' : '%b%p'),
120+
'buildCommand' => 'dotnet publish %b%p' . $csprojExtension
121+
. ' -o %b --nologo --use-current-runtime --sc -v:q',
122+
'runCommand' => '%b%p' . (PHP_OS_FAMILY == 'Windows' ? '.exe' : ''),
119123
'cleanPatterns' => [
120-
(PHP_OS_FAMILY == 'Windows' ? '%b%p.exe' : '%b%p'),
124+
'%b%p' . (PHP_OS_FAMILY == 'Windows' ? '.exe' : ''),
121125
'%b%p.pdb',
122126
],
123127
],
@@ -363,9 +367,13 @@
363367
'sourceExtension' => '.vb',
364368
'codinGameVersion' => '.NET Core 3.1.201',
365369
'versionCommand' => 'dotnet --version',
366-
'buildCommand' => '',
367-
'runCommand' => 'dotnet run %s',
368-
'cleanPatterns' => [],
370+
'buildCommand' => 'dotnet publish %b' . $vbProjectName . $vbprojExtension
371+
. ' -o %b --nologo --use-current-runtime --sc -v:q', // -v:q
372+
'runCommand' => '%b' . $vbProjectName . (PHP_OS_FAMILY == 'Windows' ? '.exe' : ''),
373+
'cleanPatterns' => [
374+
'%b' . $vbProjectName . (PHP_OS_FAMILY == 'Windows' ? '.exe' : ''),
375+
'%b' . $vbProjectName . '.pdb',
376+
],
369377
],
370378
// unsupported on CodinGame
371379
// todo: check
@@ -417,7 +425,6 @@
417425
$languageNonEmptyStringConfigKeys = ['sourceExtension', 'runCommand'];
418426
$languageOptionalStringConfigKeys = ['sourcePath', 'codinGameVersion', 'versionCommand', 'buildCommand'];
419427
$languageArrayConfigKeys = ['excludePuzzles', 'includePuzzles', 'runOnlyPuzzles'];
420-
$csprojExtension = ".csproj";
421428
$csprojTemplate =
422429
"<Project Sdk=\"Microsoft.NET.Sdk\">
423430
<ItemGroup>
@@ -799,8 +806,8 @@
799806
}
800807
}
801808
// --------------------------------------------------------------------
802-
// Special case for C#: delete Directory.build.props file
803-
if (($language == 'c#') and $config['clean']) {
809+
// Special case for C# and VB.NET: delete Directory.build.props file
810+
if ((($language == 'c#') or ($language == 'vb.net')) and $config['clean']) {
804811
if (file_exists($csDirectoryBuildPropsFilename)) {
805812
$unlinkResult = unlink($csDirectoryBuildPropsFilename);
806813
if (!$unlinkResult) {
@@ -918,9 +925,13 @@
918925
}
919926
}
920927
// --------------------------------------------------------------------
921-
// Special case for C#
922-
if (($language == 'c#') and !$config['dry-run']) {
923-
$csprojFilename = $config['buildPath'] . $puzzleName . $csprojExtension;
928+
// Special case for C# and VB.NET
929+
if ((($language == 'c#') or ($language == 'vb.net')) and !$config['dry-run']) {
930+
if ($language == 'c#') {
931+
$csprojFilename = $config['buildPath'] . $puzzleName . $csprojExtension;
932+
} else {
933+
$csprojFilename = $config['buildPath'] . $vbProjectName . $vbprojExtension;
934+
}
924935
if (file_exists($csprojFilename)) {
925936
$unlinkResult = unlink($csprojFilename);
926937
if ($config['clean']) {

cgtest_screenshot_base.png

-30 Bytes
Loading

0 commit comments

Comments
 (0)