diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2016-02-21 01:07:44 +0200 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2016-02-21 01:07:44 +0200 |
commit | b7059d35f90a7cc8b07944d78984afa832190bdc (patch) | |
tree | fe7ab8979d02178180ddd0e486ab6006016bcf67 /serial_link/tests | |
parent | 8e2d70d11fd852cf6e33b48a027a5fba61c08779 (diff) |
Working triple buffering
Diffstat (limited to 'serial_link/tests')
-rw-r--r-- | serial_link/tests/triple_buffered_object_tests.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/serial_link/tests/triple_buffered_object_tests.c b/serial_link/tests/triple_buffered_object_tests.c index 5fa1b8b62f..cd3ecb6a22 100644 --- a/serial_link/tests/triple_buffered_object_tests.c +++ b/serial_link/tests/triple_buffered_object_tests.c @@ -47,6 +47,12 @@ Ensure(TripleBufferedObject, writes_and_reads_object) { assert_that(dst, is_equal_to(src)); } +Ensure(TripleBufferedObject, does_not_read_empty) { + uint32_t dst; + bool res = triple_buffer_read(4, (triple_buffer_object_t*)&test_object, &dst); + assert_that(res, is_equal_to(false)); +} + Ensure(TripleBufferedObject, writes_and_reads_object_decomposed) { uint32_t src = 0x3456ABCC; uint32_t dst; @@ -79,6 +85,7 @@ Ensure(TripleBufferedObject, performs_another_write_in_the_middle_of_read) { assert_that(dst, is_equal_to(1)); triple_buffer_read(4, (triple_buffer_object_t*)&test_object, &dst); assert_that(dst, is_equal_to(2)); + assert_that(triple_buffer_read(4, (triple_buffer_object_t*)&test_object, &dst), is_equal_to(false)); } Ensure(TripleBufferedObject, performs_two_writes_in_the_middle_of_read) { @@ -95,4 +102,5 @@ Ensure(TripleBufferedObject, performs_two_writes_in_the_middle_of_read) { assert_that(dst, is_equal_to(1)); triple_buffer_read(4, (triple_buffer_object_t*)&test_object, &dst); assert_that(dst, is_equal_to(3)); + assert_that(triple_buffer_read(4, (triple_buffer_object_t*)&test_object, &dst), is_equal_to(false)); } |