From 7956a11df60e7fb610165da79b5f0e45175c9af5 Mon Sep 17 00:00:00 2001 From: Guillaume Pinot Date: Sat, 8 Mar 2014 16:56:07 +0100 Subject: [PATCH] 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. --- src/test/bench/shootout-reverse-complement.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); }