Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for config parsing (including custom-id handling via kwar…
…gs in get_config)
- Loading branch information
1 parent
b0ed6a6
commit 2e58b70
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Cambrian | ||
|
||
@testset "Configuration parsing" begin | ||
cfg_filename = string(@__DIR__, "/../cfg/oneplus.yaml") | ||
cfg = get_config(cfg_filename) | ||
|
||
@test cfg.n_population == 5 | ||
@test cfg.d_fitness == 1 | ||
@test cfg.save_gen == 0 | ||
@test cfg.n_genes == 10 | ||
@test cfg.n_gen == 10 | ||
@test cfg.seed == 0 | ||
@test cfg.m_rate == 0.3 | ||
@test cfg.n_elite == 1 | ||
@test cfg.log_gen == 0 | ||
@test haskey(cfg, :id) | ||
|
||
default_id = cfg.id | ||
my_custom_id = "custom_id" | ||
my_custom_arg = 0x01 | ||
cfg = get_config(cfg_filename, custom_arg=0x01, id=my_custom_id) | ||
@test cfg.id == my_custom_id | ||
@test cfg.id != default_id | ||
@test haskey(cfg, :custom_arg) | ||
@test cfg.custom_arg == my_custom_arg | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters