Skip to content
Snippets Groups Projects
Commit 9533e27f authored by Jorge Aparicio's avatar Jorge Aparicio
Browse files

test two consecutive operations

parent 37c8b5b6
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ use std::thread;
use heapless::RingBuffer;
#[test]
fn tsan() {
fn once() {
static mut RB: RingBuffer<i32, [i32; 4]> = RingBuffer::new();
unsafe { RB.split() }.0.enqueue(0).unwrap();
......@@ -18,3 +18,21 @@ fn tsan() {
unsafe { RB.split() }.1.dequeue().unwrap();
});
}
#[test]
fn twice() {
static mut RB: RingBuffer<i32, [i32; 8]> = RingBuffer::new();
unsafe { RB.split() }.0.enqueue(0).unwrap();
unsafe { RB.split() }.0.enqueue(1).unwrap();
thread::spawn(|| {
unsafe { RB.split() }.0.enqueue(2).unwrap();
unsafe { RB.split() }.0.enqueue(3).unwrap();
});
thread::spawn(|| {
unsafe { RB.split() }.1.dequeue().unwrap();
unsafe { RB.split() }.1.dequeue().unwrap();
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment