Skip to content

Commit 4a44544

Browse files
authored
Update unit.jl
1 parent 256b361 commit 4a44544

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/unit.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1+
@testset "get_slurm_ntasks_int()" begin
2+
c = withenv(SLURM_NTASKS => "56") do
3+
SlurmClusterManager.get_slurm_jobid_int()
4+
end
5+
@test c == 34
16

7+
withenv("SLURM_NTASKS" => nothing) do
8+
@test_throws ErrorException SlurmClusterManager.get_slurm_jobid_int()
9+
end
10+
end
11+
12+
@testset "get_slurm_jobid_int()" begin
13+
a = withenv("SLURM_JOB_ID" => "12", SLURM_JOBID => nothing) do
14+
SlurmClusterManager.get_slurm_jobid_int()
15+
end
16+
@test a == 12
17+
18+
b = withenv("SLURM_JOB_ID" => nothing, SLURM_JOBID => "34") do
19+
SlurmClusterManager.get_slurm_jobid_int()
20+
end
21+
@test a == 34
22+
23+
withenv("SLURM_JOB_ID" => nothing, SLURM_JOBID => nothing) do
24+
@test_throws ErrorException SlurmClusterManager.get_slurm_jobid_int()
25+
end
26+
end

0 commit comments

Comments
 (0)