Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved test on optional and default input #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions conformance_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1900,35 +1900,35 @@
tags: [ workflow, shell_command ]

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

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

- job: tests/empty.json
output: {"o": 4}
output: {"o": 16}
tool: tests/io-int-optional-wf.cwl
id: workflow_integer_input_optional_unspecified
doc: Test optional integer workflow inputs (unspecified)
tags: [ workflow, inline_javascript, expression_tool ]

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

- job: tests/empty.json
output: {"o": 8}
output: {"o": 128}
tool: tests/io-int-default-wf.cwl
id: workflow_integer_input_default_unspecified
doc: Test default integer workflow inputs (unspecified)
Expand Down
26 changes: 25 additions & 1 deletion tests/io-int-default-wf.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ inputs:
i:
type: int
default: 4
i1:
type: int[]
default: [4, 9]
i2:
type:
type: record
fields:
a:
type: int
b:
type: float
default: {"a": 4, "b": 9.0}

outputs:
o:
Expand All @@ -19,14 +31,26 @@ steps:
step1:
in:
i: i
i1: i1
i2: i2
out: [o]
run:
class: ExpressionTool
inputs:
i:
type: int
i1:
type: int[]
i2:
type:
type: record
fields:
a:
type: int
b:
type: float
outputs:
o:
type: int
expression: >
${return {'o': (inputs.i || 2) * 2};}
${return {'o': (inputs.i || 2) * ((inputs.i1 != null && inputs.i1.length > 0) ? inputs.i1[0] : 2) * ((inputs.i2 != null) ? inputs.i2.a : 2) * 2};}
26 changes: 25 additions & 1 deletion tests/io-int-optional-wf.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ requirements:
inputs:
i:
type: int?
i1:
type: int[]?
i2:
type:
- "null"
- type: record
fields:
a:
type: int
b:
type: float

outputs:
o:
Expand All @@ -18,14 +29,27 @@ steps:
step1:
in:
i: i
i1: i1
i2: i2
out: [o]
run:
class: ExpressionTool
inputs:
i:
type: int?
i1:
type: int[]?
i2:
type:
- "null"
- type: record
fields:
a:
type: int
b:
type: float
outputs:
o:
type: int
expression: >
${return {'o': (inputs.i || 2) * 2};}
${return {'o': (inputs.i || 2) * ((inputs.i1 != null && inputs.i1.length > 0) ? inputs.i1[0] : 2) * ((inputs.i2 != null) ? inputs.i2.a : 2) * 2};}
26 changes: 24 additions & 2 deletions tests/io-int-wf.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ requirements:
inputs:
i:
type: int

i1:
type: int[]
i2:
type:
type: record
fields:
a:
type: int
b:
type: float

outputs:
o:
type: int
Expand All @@ -18,14 +28,26 @@ steps:
step1:
in:
i: i
i1: i1
i2: i2
out: [o]
run:
class: ExpressionTool
inputs:
i:
type: int
i1:
type: int[]
i2:
type:
type: record
fields:
a:
type: int
b:
type: float
outputs:
o:
type: int
expression: >
${return {'o': inputs.i * 2};}
${return {'o': inputs.i * ((inputs.i1.length > 0) ? inputs.i1[0] : 2) * inputs.i2.a * 2};}
2 changes: 1 addition & 1 deletion tests/io-int.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"i": 5}
{"i": 5, "i1": [5, 2], "i2": {"a": 5, "b": 2.0}}