From f1df1d1a51f310553fd8bcb831215307ec2609ae Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 7 Jan 2011 22:22:35 -0500 Subject: Don't allow circular_buffer to shrink below its original size when unit_sz is not a power of two --- src/test/run-pass/chan-poweroftwo.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/test') diff --git a/src/test/run-pass/chan-poweroftwo.rs b/src/test/run-pass/chan-poweroftwo.rs index da9a62cc..be7c18ad 100644 --- a/src/test/run-pass/chan-poweroftwo.rs +++ b/src/test/run-pass/chan-poweroftwo.rs @@ -39,7 +39,7 @@ impure fn test_grow() { } // Don't allow the buffer to shrink below it's original size -impure fn test_shrink() { +impure fn test_shrink1() { let port[i8] myport = port(); auto mychan = chan(myport); @@ -47,10 +47,26 @@ impure fn test_shrink() { auto x <- myport; } +impure fn test_shrink2() { + let port[record] myport = port(); + auto mychan = chan(myport); + + let record val = rec(val1=0i32, val2=0i32, val3=0i32); + + for each (uint i in _uint.range(0u, 100u)) { + mychan <| val; + } + + for each (uint i in _uint.range(0u, 100u)) { + auto x <- myport; + } +} + impure fn main() { test_init(); test_grow(); - test_shrink(); + test_shrink1(); + test_shrink2(); } // Local Variables: -- cgit v1.2.3