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

Add test to handle array array string type outputs bios 557 #60

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
51 changes: 51 additions & 0 deletions src/wdlci/wdl_tests/compare_nested_array_of_strings.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version 1.0

# Check if two nested arrays of strings are identical by writing a TSV file of the data structure
# Input type: Array[Array[String]]

task compare_array_array_strings {
input {
Array[Array[String]] current_run_output
Array[Array[String]] validated_output
}

Int disk_size = 10

Int current_run_output_length = length(flatten(current_run_output))
Int validated_output_length = length(flatten(validated_output))

command <<<
set -euo pipefail

err() {
message=$1
echo -e "[ERROR] $message" >&2
}

if [[ ~{current_run_output_length} != ~{validated_output_length} ]]; then
err "Nested array of strings have different flattened lengths.
Current run output length: [~{current_run_output_length}]
Validated output length: [~{validated_output_length}]"
exit 1
else
if diff -q ~{write_tsv(current_run_output)} ~{write_tsv(validated_output)}; then
echo "Nested array of strings are identical."
else
err "Nested array of strings are of the same length but are not identical."
exit 1
fi
fi
>>>

output {
}

runtime {
docker: "ubuntu:xenial"
cpu: 1
memory: "3.75 GB"
disk: disk_size + " GB"
disks: "local-disk " + disk_size + " HDD"
preemptible: 1
}
}