From 2da4fecacd1b61e9e090e93c33394712fa7f066c Mon Sep 17 00:00:00 2001 From: Roy Frostig Date: Fri, 20 Aug 2010 12:57:38 -0700 Subject: Test the buffered reader and writer in _io. --- src/lib/_str.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/lib/_str.rs') diff --git a/src/lib/_str.rs b/src/lib/_str.rs index 807edf31..a29e1daa 100644 --- a/src/lib/_str.rs +++ b/src/lib/_str.rs @@ -11,6 +11,22 @@ native "rust" mod rustrt { fn refcount[T](str s) -> uint; } +fn eq(str a, str b) -> bool { + let uint i = byte_len(a); + if (byte_len(b) != i) { + ret false; + } + while (i > 0u) { + i -= 1u; + auto cha = a.(i); + auto chb = b.(i); + if (cha != chb) { + ret false; + } + } + ret true; +} + fn is_utf8(vec[u8] v) -> bool { fail; // FIXME } -- cgit v1.2.3