Skip to content

Commit

Permalink
Get more simple tests with conc::sync::Treiber.
Browse files Browse the repository at this point in the history
  • Loading branch information
ticki committed Jun 9, 2017
1 parent 51bab5c commit c7c79f8
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions conc/src/sync/treiber.rs
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down

0 comments on commit c7c79f8

Please sign in to comment.