From 1acdac4bef87e11d1e3c5cb9dbb3a231079bbb29 Mon Sep 17 00:00:00 2001 From: Michael Kotliar Date: Mon, 5 Jun 2017 20:57:26 -0400 Subject: [PATCH] Add test for MultipleInputFeatureRequirement If the source has a type set as a list of two or more items, it will be added to the result array exactly the same number of times as the length of its type list --- v1.0/conformance_test_v1.0.yaml | 6 ++++ v1.0/v1.0/sum-job.json | 4 +++ v1.0/v1.0/sum-wf.cwl | 55 +++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 v1.0/v1.0/sum-job.json create mode 100644 v1.0/v1.0/sum-wf.cwl diff --git a/v1.0/conformance_test_v1.0.yaml b/v1.0/conformance_test_v1.0.yaml index e5db1d006..17e462fb5 100644 --- a/v1.0/conformance_test_v1.0.yaml +++ b/v1.0/conformance_test_v1.0.yaml @@ -981,3 +981,9 @@ size: 15 tool: v1.0/imported-hint.cwl doc: Test hints with $import + +- job: v1.0/sum-job.json + output: + result: 12 + tool: v1.0/sum-wf.cwl + doc: Test step input with multiple sources with multiple types \ No newline at end of file diff --git a/v1.0/v1.0/sum-job.json b/v1.0/v1.0/sum-job.json new file mode 100644 index 000000000..64e29bfa1 --- /dev/null +++ b/v1.0/v1.0/sum-job.json @@ -0,0 +1,4 @@ +{ + "int_1": 5, + "int_2": 7 +} \ No newline at end of file diff --git a/v1.0/v1.0/sum-wf.cwl b/v1.0/v1.0/sum-wf.cwl new file mode 100644 index 000000000..081b33931 --- /dev/null +++ b/v1.0/v1.0/sum-wf.cwl @@ -0,0 +1,55 @@ +cwlVersion: v1.0 +class: Workflow + +requirements: + - class: StepInputExpressionRequirement + - class: MultipleInputFeatureRequirement + - class: InlineJavascriptRequirement + +inputs: + int_1: + type: int? + int_2: + type: int? + +outputs: + result: + type: int + outputSource: sum/result + +steps: + sum: + in: + data: + source: [int_1, int_2] + valueFrom: | + ${ + var sum = 0; + for (var i = 0; i < self.length; i++){ + sum += self[i]; + }; + return sum; + } + out: + - result + run: + class: ExpressionTool + inputs: + data: + type: int + outputs: + result: int + expression: | + ${ + return {"result": inputs.data}; + } + + + + + + + + + +