unittest_ypipe.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MPL-2.0 */
2 
3 #include "../tests/testutil.hpp"
4 
5 #include <ypipe.hpp>
6 
7 #include <unity.h>
8 
9 void setUp ()
10 {
11 }
12 void tearDown ()
13 {
14 }
15 
16 void test_create ()
17 {
18  zmq::ypipe_t<int, 1> ypipe;
19 }
20 
22 {
23  zmq::ypipe_t<int, 1> ypipe;
24  TEST_ASSERT_FALSE (ypipe.check_read ());
25 }
26 
28 {
29  zmq::ypipe_t<int, 1> ypipe;
30  int read_value = -1;
31  TEST_ASSERT_FALSE (ypipe.read (&read_value));
32  TEST_ASSERT_EQUAL (-1, read_value);
33 }
34 
36 {
37  const int value = 42;
38  zmq::ypipe_t<int, 1> ypipe;
39  ypipe.write (value, false);
40  TEST_ASSERT_FALSE (ypipe.check_read ());
41  int read_value = -1;
42  TEST_ASSERT_FALSE (ypipe.read (&read_value));
43  TEST_ASSERT_EQUAL_INT (-1, read_value);
44 }
45 
47 {
48  const int value = 42;
49  zmq::ypipe_t<int, 1> ypipe;
50  ypipe.write (value, false);
51  ypipe.flush ();
52  TEST_ASSERT_TRUE (ypipe.check_read ());
53  int read_value = -1;
54  TEST_ASSERT_TRUE (ypipe.read (&read_value));
55  TEST_ASSERT_EQUAL_INT (value, read_value);
56 }
57 
58 int main (void)
59 {
61 
62  UNITY_BEGIN ();
68 
69  return UNITY_END ();
70 }
UNITY_END
return UNITY_END()
ypipe.hpp
TEST_ASSERT_TRUE
#define TEST_ASSERT_TRUE(condition)
Definition: unity.h:121
RUN_TEST
#define RUN_TEST(func)
Definition: unity_internals.h:615
TEST_ASSERT_FALSE
#define TEST_ASSERT_FALSE(condition)
Definition: unity.h:123
test_check_read_empty
void test_check_read_empty()
Definition: unittest_ypipe.cpp:21
test_write_complete_and_flush_and_check_read_and_read
void test_write_complete_and_flush_and_check_read_and_read()
Definition: unittest_ypipe.cpp:46
test_read_empty
void test_read_empty()
Definition: unittest_ypipe.cpp:27
main
int main(void)
Definition: unittest_ypipe.cpp:58
TEST_ASSERT_EQUAL
#define TEST_ASSERT_EQUAL(expected, actual)
Definition: unity.h:133
TEST_ASSERT_EQUAL_INT
#define TEST_ASSERT_EQUAL_INT(expected, actual)
Definition: unity.h:128
unity.h
tearDown
void tearDown()
Definition: unittest_ypipe.cpp:12
setup_test_environment
void setup_test_environment(int timeout_seconds_)
Definition: testutil.cpp:201
UNITY_BEGIN
UNITY_BEGIN()
test_write_complete_and_check_read_and_read
void test_write_complete_and_check_read_and_read()
Definition: unittest_ypipe.cpp:35
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
test_create
void test_create()
Definition: unittest_ypipe.cpp:16
setUp
void setUp()
Definition: unittest_ypipe.cpp:9


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:00