Mercurial > repos > jmchilton > apitooltests
changeset 0:5f452975cfb4
Initial commit.
author | John Chilton <jmchilton@gmail.com> |
---|---|
date | Sat, 08 Feb 2014 20:09:35 -0600 |
parents | |
children | 6fc62e74d7a5 |
files | disambiguate_cond.xml disambiguate_repeats.xml test-data/simple_line.txt test-data/simple_line_alternative.txt test-data/simple_line_x2.txt test-data/simple_line_x3.txt test-data/simple_line_x5.txt test-data/simple_lines_interleaved.txt |
diffstat | 8 files changed, 173 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/disambiguate_cond.xml Sat Feb 08 20:09:35 2014 -0600 @@ -0,0 +1,94 @@ +<tool id="disambiguate_cond" name="disambiguate_cond"> + <command> + echo "$p1.p1v $p2.p2v $p3.p3v" > $out_file1; cat "$files.p4.file" >> $out_file1; + </command> + <inputs> + <conditional name="p1"> + <param type="boolean" name="use" /> + <when value="true"> + <param name="p1v" value="4" type="integer" /> + </when> + <when value="false"> + <param name="p1v" value="7" type="integer" /> + </when> + </conditional> + <conditional name="p2"> + <param type="boolean" name="use" /> + <when value="true"> + <param name="p2v" value="4" type="integer" /> + </when> + <when value="false"> + <param name="p2v" value="7" type="integer" /> + </when> + </conditional> + <conditional name="p3"> + <param type="boolean" name="use" /> + <when value="true"> + <param name="p3v" value="4" type="integer" /> + </when> + <when value="false"> + <param name="p3v" value="7" type="integer" /> + </when> + </conditional> + <conditional name="files"> + <param name="attach_files" type="boolean" checked="true" /> + <when value="true"> + <conditional name="p4"> + <param type="boolean" name="use" /> + <when value="true"> + <param type="data" name="file" /> + </when> + </conditional> + </when> + </conditional> + </inputs> + <outputs> + <data name="out_file1" format="txt" /> + </outputs> + <tests interactor="api"> + <!-- Can use nested conditional blocks as shown below to disambiguate + various nested parameters. --> + <test> + <conditional name="p1"> + <param name="use" value="False"/> + </conditional> + <conditional name="p2"> + <param name="use" value="True"/> + </conditional> + <conditional name="p3"> + <param name="use" value="False"/> + </conditional> + <conditional name="files"> + <param name="attach_files" value="True" /> + <conditional name="p4"> + <param name="use" value="True"/> + <param name="file" value="simple_line_alternative.txt" /> + </conditional> + </conditional> + <output name="out_file1"> + <assert_contents> + <has_line line="7 4 7" /> + <has_line line="This is a different line of text." /> + </assert_contents> + </output> + </test> + <!-- Can also use a more concise, flat verison of this, but it the + above version is more clear and should be considered preferable. + --> + <test> + <param name="p1|use" value="True"/> + <param name="p2|use" value="False"/> + <param name="p3|use" value="True"/> + <param name="p4|use" value="True" /> + <!-- Only need to specify enough of a suffix to disambiguate, + but don't do this - it is too clever. --> + <param name="p4|file" value="simple_line.txt" /> + <output name="out_file1"> + <assert_contents> + <has_line line="4 7 4" /> + <has_line line="This is a line of text." /> + </assert_contents> + </output> + </test> + </tests> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/disambiguate_repeats.xml Sat Feb 08 20:09:35 2014 -0600 @@ -0,0 +1,63 @@ +<tool id="disambiguate_repeats" name="disambiguate_repeats"> + <command> + cat #for $q in $queries# ${q.input} #end for# #for $q in $more_queries# ${q.input} #end for# > $out_file1 + </command> + <inputs> + <repeat name="queries" title="Dataset"> + <param name="input" type="data" label="Select" /> + </repeat> + <repeat name="more_queries" title="Dataset"> + <param name="input" type="data" label="Select" /> + </repeat> + </inputs> + <outputs> + <data name="out_file1" format="txt" /> + </outputs> + <tests> + <!-- Can disambiguate repeats and specify multiple blocks using, + nested structure. --> + <test interactor="api"> + <repeat name="queries"> + <param name="input" value="simple_line.txt"/> + </repeat> + <repeat name="more_queries"> + <param name="input" value="simple_line_alternative.txt"/> + </repeat> + <output name="out_file1"> + <assert_contents> + <has_line line="This is a line of text." /> + <has_line line="This is a different line of text." /> + </assert_contents> + </output> + </test> + <!-- Multiple such blocks can be specified but only with newer API + driven tests. --> + <test interactor="api"> + <repeat name="queries"> + <param name="input" value="simple_line.txt"/> + </repeat> + <repeat name="queries"> + <param name="input" value="simple_line_alternative.txt"/> + </repeat> + <repeat name="more_queries"> + <param name="input" value="simple_line.txt"/> + </repeat> + <repeat name="more_queries"> + <param name="input" value="simple_line_alternative.txt"/> + </repeat> + <output name="out_file1" file="simple_lines_interleaved.txt"/> + </test> + <!-- Can also use prefixes to disambiguate inputs or force order, but + the above nested structure is preferable. --> + <test interactor="api"> + <param name="queries_1|input" value="simple_line_alternative.txt"/> + <param name="queries_0|input" value="simple_line.txt"/> + + <param name="more_queries_1|input" value="simple_line_alternative.txt" /> + <param name="more_queries_0|input" value="simple_line.txt"/> + + <output name="out_file1" file="simple_lines_interleaved.txt"/> + </test> + + </tests> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/simple_line.txt Sat Feb 08 20:09:35 2014 -0600 @@ -0,0 +1,1 @@ +This is a line of text.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/simple_line_alternative.txt Sat Feb 08 20:09:35 2014 -0600 @@ -0,0 +1,1 @@ +This is a different line of text. \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/simple_line_x2.txt Sat Feb 08 20:09:35 2014 -0600 @@ -0,0 +1,2 @@ +This is a line of text. +This is a line of text.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/simple_line_x3.txt Sat Feb 08 20:09:35 2014 -0600 @@ -0,0 +1,3 @@ +This is a line of text. +This is a line of text. +This is a line of text.