Skip to content
Permalink
Browse files

Get more simple tests with `conc::sync::Treiber`.

  • Loading branch information...
ticki committed Jun 9, 2017
1 parent 51bab5c commit c7c79f8ff635211e4d3b2eac6a9d08a6e3604752
Showing with 26 additions and 2 deletions.
  1. +26 −2 conc/src/sync/treiber.rs
@@ -112,8 +112,9 @@ mod tests {
use std::sync::Arc;

#[test]
fn simple() {
fn simple1() {
let stack = Treiber::new();

stack.push(1);
stack.push(200);
stack.push(44);
@@ -125,7 +126,30 @@ mod tests {
}

#[test]
fn single_thread() {
fn simple2() {
let stack = Treiber::new();

for _ in 0..16 {
stack.push(1);
stack.push(200);
stack.push(44);

assert_eq!(*stack.pop().unwrap(), 44);
assert_eq!(*stack.pop().unwrap(), 200);
stack.push(20000);

assert_eq!(*stack.pop().unwrap(), 20000);
assert_eq!(*stack.pop().unwrap(), 1);

assert!(stack.pop().is_none());
assert!(stack.pop().is_none());
assert!(stack.pop().is_none());
assert!(stack.pop().is_none());
}
}

#[test]
fn simple3() {
let stack = Treiber::new();

for i in 0..10000 {

0 comments on commit c7c79f8

Please sign in to comment.
You can’t perform that action at this time.