Skip to content

Commit 41c679d

Browse files
LanderOttomr-c
authored andcommitted
Improved test on optional input adding input types as and
1 parent 84cfedb commit 41c679d

File tree

5 files changed

+80
-10
lines changed

5 files changed

+80
-10
lines changed

conformance_tests.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,21 +1900,21 @@
19001900
tags: [ workflow, shell_command ]
19011901

19021902
- job: tests/io-int.json
1903-
output: {"o": 10}
1903+
output: {"o": 250}
19041904
tool: tests/io-int-wf.cwl
19051905
id: workflow_integer_input
19061906
doc: Test integer workflow input and outputs
19071907
tags: [ workflow, inline_javascript, expression_tool ]
19081908

19091909
- job: tests/io-int.json
1910-
output: {"o": 10}
1910+
output: {"o": 250}
19111911
tool: tests/io-int-optional-wf.cwl
19121912
id: workflow_integer_input_optional_specified
19131913
doc: Test optional integer workflow inputs (specified)
19141914
tags: [ workflow, inline_javascript, expression_tool ]
19151915

19161916
- job: tests/empty.json
1917-
output: {"o": 4}
1917+
output: {"o": 16}
19181918
tool: tests/io-int-optional-wf.cwl
19191919
id: workflow_integer_input_optional_unspecified
19201920
doc: Test optional integer workflow inputs (unspecified)
@@ -1930,14 +1930,14 @@
19301930
tags: [ scatter, workflow ]
19311931

19321932
- job: tests/io-int.json
1933-
output: {"o": 10}
1933+
output: {"o": 250}
19341934
tool: tests/io-int-default-wf.cwl
19351935
id: workflow_integer_input_default_specified
19361936
doc: Test default integer workflow inputs (specified)
19371937
tags: [ workflow, inline_javascript, expression_tool ]
19381938

19391939
- job: tests/empty.json
1940-
output: {"o": 8}
1940+
output: {"o": 128}
19411941
tool: tests/io-int-default-wf.cwl
19421942
id: workflow_integer_input_default_unspecified
19431943
doc: Test default integer workflow inputs (unspecified)

tests/io-int-default-wf.cwl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ inputs:
99
i:
1010
type: int
1111
default: 4
12+
i1:
13+
type: int[]
14+
default: [4, 9]
15+
i2:
16+
type:
17+
type: record
18+
fields:
19+
a:
20+
type: int
21+
b:
22+
type: float
23+
default: {"a": 4, "b": 9.0}
1224

1325
outputs:
1426
o:
@@ -19,14 +31,26 @@ steps:
1931
step1:
2032
in:
2133
i: i
34+
i1: i1
35+
i2: i2
2236
out: [o]
2337
run:
2438
class: ExpressionTool
2539
inputs:
2640
i:
2741
type: int
42+
i1:
43+
type: int[]
44+
i2:
45+
type:
46+
type: record
47+
fields:
48+
a:
49+
type: int
50+
b:
51+
type: float
2852
outputs:
2953
o:
3054
type: int
3155
expression: >
32-
${return {'o': (inputs.i || 2) * 2};}
56+
${return {'o': (inputs.i || 2) * ((inputs.i1 != null && inputs.i1.length > 0) ? inputs.i1[0] : 2) * ((inputs.i2 != null) ? inputs.i2.a : 2) * 2};}

tests/io-int-optional-wf.cwl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ requirements:
88
inputs:
99
i:
1010
type: int?
11+
i1:
12+
type: int[]?
13+
i2:
14+
type:
15+
- "null"
16+
- type: record
17+
fields:
18+
a:
19+
type: int
20+
b:
21+
type: float
1122

1223
outputs:
1324
o:
@@ -18,14 +29,27 @@ steps:
1829
step1:
1930
in:
2031
i: i
32+
i1: i1
33+
i2: i2
2134
out: [o]
2235
run:
2336
class: ExpressionTool
2437
inputs:
2538
i:
2639
type: int?
40+
i1:
41+
type: int[]?
42+
i2:
43+
type:
44+
- "null"
45+
- type: record
46+
fields:
47+
a:
48+
type: int
49+
b:
50+
type: float
2751
outputs:
2852
o:
2953
type: int
3054
expression: >
31-
${return {'o': (inputs.i || 2) * 2};}
55+
${return {'o': (inputs.i || 2) * ((inputs.i1 != null && inputs.i1.length > 0) ? inputs.i1[0] : 2) * ((inputs.i2 != null) ? inputs.i2.a : 2) * 2};}

tests/io-int-wf.cwl

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,17 @@ requirements:
88
inputs:
99
i:
1010
type: int
11-
11+
i1:
12+
type: int[]
13+
i2:
14+
type:
15+
type: record
16+
fields:
17+
a:
18+
type: int
19+
b:
20+
type: float
21+
1222
outputs:
1323
o:
1424
type: int
@@ -18,14 +28,26 @@ steps:
1828
step1:
1929
in:
2030
i: i
31+
i1: i1
32+
i2: i2
2133
out: [o]
2234
run:
2335
class: ExpressionTool
2436
inputs:
2537
i:
2638
type: int
39+
i1:
40+
type: int[]
41+
i2:
42+
type:
43+
type: record
44+
fields:
45+
a:
46+
type: int
47+
b:
48+
type: float
2749
outputs:
2850
o:
2951
type: int
3052
expression: >
31-
${return {'o': inputs.i * 2};}
53+
${return {'o': inputs.i * ((inputs.i1.length > 0) ? inputs.i1[0] : 2) * inputs.i2.a * 2};}

tests/io-int.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"i": 5}
1+
{"i": 5, "i1": [5, 2], "i2": {"a": 5, "b": 2.0}}

0 commit comments

Comments
 (0)