diff options
| author | Guillaume Pinot <texitoi@texitoi.eu> | 2014-03-08 16:56:07 +0100 |
|---|---|---|
| committer | Guillaume Pinot <texitoi@texitoi.eu> | 2014-03-11 08:44:32 +0100 |
| commit | 7956a11df60e7fb610165da79b5f0e45175c9af5 (patch) | |
| tree | 379eda31bce6624953ff0629f2ff5e7b85f1727e | |
| parent | 33768c46ec980a911284d77804e5e45ead6530eb (diff) | |
| download | rust-7956a11df60e7fb610165da79b5f0e45175c9af5.tar.gz rust-7956a11df60e7fb610165da79b5f0e45175c9af5.zip | |
fix a bug in shootout-reverse-complement, official tests should pass with it
In the "reverse-complement" loop, if there is an odd number of element, we forget to complement the element in the middle. For example, if the input is "ggg", the result before the fix is "CgC" instead of "CCC". This is because of this bug that the official shootout says that the rust version is in "Bad Output". This commit should fix this error.
| -rw-r--r-- | src/test/bench/shootout-reverse-complement.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index 6011dcae676..acd6620d4af 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -9,6 +9,7 @@ // except according to those terms. // ignore-android doesn't terminate? +// ignore-pretty use std::iter::range_step; use std::io::{stdin, stdout, File}; @@ -73,10 +74,11 @@ fn main() { *front = complements[*back]; *back = tmp; } + (Some(last), None) => *last = complements[*last], // last element _ => break // vector exhausted. } } } - stdout().write(data); + stdout().write(data).unwrap(); } |
