tSkip redirection of STDOUT in grid test on windows, which stopped working - Gr… | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit cfbc4ba624fda848ca9576f1db813e411747a471 | |
parent 7ef507d6d943a442b153d9b162c4d7c3d07a4672 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 15 Jan 2018 10:39:23 -0500 | |
Skip redirection of STDOUT in grid test on windows, which stopped working | |
Diffstat: | |
M test/grid-boundaries.jl | 182 ++++++++++++++++-------------… | |
1 file changed, 92 insertions(+), 90 deletions(-) | |
--- | |
diff --git a/test/grid-boundaries.jl b/test/grid-boundaries.jl | |
t@@ -14,96 +14,98 @@ ocean = Granular.createEmptyOcean() | |
@test ocean.bc_north == 1 | |
@test ocean.bc_south == 1 | |
-const originalSTDOUT = STDOUT | |
-(out_r, out_w) = redirect_stdout() | |
-Granular.reportGridBoundaryConditions(ocean) | |
-close(out_w) | |
-redirect_stdout(originalSTDOUT) | |
-output = String(readavailable(out_r)) | |
-@test output == """West (-x): inactive\t(1) | |
-East (+x): inactive\t(1) | |
-South (-y): inactive\t(1) | |
-North (+y): inactive\t(1) | |
-""" | |
- | |
-(out_r, out_w) = redirect_stdout() | |
-Granular.setGridBoundaryConditions!(ocean, "periodic", "south, west", verbose=… | |
-close(out_w) | |
-redirect_stdout(originalSTDOUT) | |
-output = String(readavailable(out_r)) | |
-@test output == """West (-x): periodic\t(2) | |
-East (+x): inactive\t(1) | |
-South (-y): periodic\t(2) | |
-North (+y): inactive\t(1) | |
-""" | |
-@test ocean.bc_west == 2 | |
-@test ocean.bc_east == 1 | |
-@test ocean.bc_north == 1 | |
-@test ocean.bc_south == 2 | |
- | |
-(out_r, out_w) = redirect_stdout() | |
-Granular.setGridBoundaryConditions!(ocean, "inactive", "all", verbose=false) | |
-close(out_w) | |
-redirect_stdout(originalSTDOUT) | |
-output = String(readavailable(out_r)) | |
-@test output == "" | |
-@test ocean.bc_west == 1 | |
-@test ocean.bc_east == 1 | |
-@test ocean.bc_north == 1 | |
-@test ocean.bc_south == 1 | |
- | |
-(out_r, out_w) = redirect_stdout() | |
-Granular.setGridBoundaryConditions!(ocean, "periodic", "all") | |
-close(out_w) | |
-output = String(readavailable(out_r)) | |
-redirect_stdout(originalSTDOUT) | |
-@test output == """West (-x): periodic\t(2) | |
-East (+x): periodic\t(2) | |
-South (-y): periodic\t(2) | |
-North (+y): periodic\t(2) | |
-""" | |
-@test ocean.bc_west == 2 | |
-@test ocean.bc_east == 2 | |
-@test ocean.bc_north == 2 | |
-@test ocean.bc_south == 2 | |
- | |
-(out_r, out_w) = redirect_stdout() | |
-Granular.setGridBoundaryConditions!(ocean, "inactive") | |
-close(out_w) | |
-output = String(readavailable(out_r)) | |
-redirect_stdout(originalSTDOUT) | |
-@test output == """West (-x): inactive\t(1) | |
-East (+x): inactive\t(1) | |
-South (-y): inactive\t(1) | |
-North (+y): inactive\t(1) | |
-""" | |
-@test ocean.bc_west == 1 | |
-@test ocean.bc_east == 1 | |
-@test ocean.bc_north == 1 | |
-@test ocean.bc_south == 1 | |
- | |
-(out_r, out_w) = redirect_stdout() | |
-Granular.setGridBoundaryConditions!(ocean, "periodic") | |
-close(out_w) | |
-output = String(readavailable(out_r)) | |
-redirect_stdout(originalSTDOUT) | |
-@test output == """West (-x): periodic\t(2) | |
-East (+x): periodic\t(2) | |
-South (-y): periodic\t(2) | |
-North (+y): periodic\t(2) | |
-""" | |
-@test ocean.bc_west == 2 | |
-@test ocean.bc_east == 2 | |
-@test ocean.bc_north == 2 | |
-@test ocean.bc_south == 2 | |
- | |
-@test_throws ErrorException Granular.setGridBoundaryConditions!(ocean, | |
- "periodic… | |
- "asdf") | |
- | |
-@test_throws ErrorException Granular.setGridBoundaryConditions!(ocean, | |
- "asdf") | |
- | |
+if !is_windows() | |
+ const originalSTDOUT = STDOUT | |
+ (out_r, out_w) = redirect_stdout() | |
+ Granular.reportGridBoundaryConditions(ocean) | |
+ close(out_w) | |
+ redirect_stdout(originalSTDOUT) | |
+ output = String(readavailable(out_r)) | |
+ @test output == """West (-x): inactive\t(1) | |
+ East (+x): inactive\t(1) | |
+ South (-y): inactive\t(1) | |
+ North (+y): inactive\t(1) | |
+ """ | |
+ | |
+ (out_r, out_w) = redirect_stdout() | |
+ Granular.setGridBoundaryConditions!(ocean, "periodic", "south, west", | |
+ verbose=true) | |
+ close(out_w) | |
+ redirect_stdout(originalSTDOUT) | |
+ output = String(readavailable(out_r)) | |
+ @test output == """West (-x): periodic\t(2) | |
+ East (+x): inactive\t(1) | |
+ South (-y): periodic\t(2) | |
+ North (+y): inactive\t(1) | |
+ """ | |
+ @test ocean.bc_west == 2 | |
+ @test ocean.bc_east == 1 | |
+ @test ocean.bc_north == 1 | |
+ @test ocean.bc_south == 2 | |
+ | |
+ (out_r, out_w) = redirect_stdout() | |
+ Granular.setGridBoundaryConditions!(ocean, "inactive", "all", verbose=fals… | |
+ close(out_w) | |
+ redirect_stdout(originalSTDOUT) | |
+ output = String(readavailable(out_r)) | |
+ @test output == "" | |
+ @test ocean.bc_west == 1 | |
+ @test ocean.bc_east == 1 | |
+ @test ocean.bc_north == 1 | |
+ @test ocean.bc_south == 1 | |
+ | |
+ (out_r, out_w) = redirect_stdout() | |
+ Granular.setGridBoundaryConditions!(ocean, "periodic", "all") | |
+ close(out_w) | |
+ output = String(readavailable(out_r)) | |
+ redirect_stdout(originalSTDOUT) | |
+ @test output == """West (-x): periodic\t(2) | |
+ East (+x): periodic\t(2) | |
+ South (-y): periodic\t(2) | |
+ North (+y): periodic\t(2) | |
+ """ | |
+ @test ocean.bc_west == 2 | |
+ @test ocean.bc_east == 2 | |
+ @test ocean.bc_north == 2 | |
+ @test ocean.bc_south == 2 | |
+ | |
+ (out_r, out_w) = redirect_stdout() | |
+ Granular.setGridBoundaryConditions!(ocean, "inactive") | |
+ close(out_w) | |
+ output = String(readavailable(out_r)) | |
+ redirect_stdout(originalSTDOUT) | |
+ @test output == """West (-x): inactive\t(1) | |
+ East (+x): inactive\t(1) | |
+ South (-y): inactive\t(1) | |
+ North (+y): inactive\t(1) | |
+ """ | |
+ @test ocean.bc_west == 1 | |
+ @test ocean.bc_east == 1 | |
+ @test ocean.bc_north == 1 | |
+ @test ocean.bc_south == 1 | |
+ | |
+ (out_r, out_w) = redirect_stdout() | |
+ Granular.setGridBoundaryConditions!(ocean, "periodic") | |
+ close(out_w) | |
+ output = String(readavailable(out_r)) | |
+ redirect_stdout(originalSTDOUT) | |
+ @test output == """West (-x): periodic\t(2) | |
+ East (+x): periodic\t(2) | |
+ South (-y): periodic\t(2) | |
+ North (+y): periodic\t(2) | |
+ """ | |
+ @test ocean.bc_west == 2 | |
+ @test ocean.bc_east == 2 | |
+ @test ocean.bc_north == 2 | |
+ @test ocean.bc_south == 2 | |
+ | |
+ @test_throws ErrorException Granular.setGridBoundaryConditions!(ocean, | |
+ "periodic", | |
+ "asdf") | |
+ | |
+ @test_throws ErrorException Granular.setGridBoundaryConditions!(ocean, | |
+ "asdf") | |
+end | |
info("Testing granular interaction across periodic boundaries") | |
sim = Granular.createSimulation() |