2 * Copyright (c) 2016 Intel Corporation.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef TEST_TLE_UDP_EVENT_H_
17 #define TEST_TLE_UDP_EVENT_H_
19 #include <gtest/gtest.h>
20 #include <rte_errno.h>
22 #include <tle_event.h>
24 struct event_state_active {
25 enum tle_ev_state event_state;
28 struct event_state_active_twice {
29 enum tle_ev_state first_state;
30 enum tle_ev_state second_state;
31 enum tle_ev_state result_state;
34 class udp_evq : public ::testing::Test {
37 /* Can parameterize here for
38 * different socket_id and max_events values
42 struct tle_evq_param evq_params;
45 virtual void SetUp(void)
47 socket_id = SOCKET_ID_ANY;
50 memset(&evq_params, 0, sizeof(struct tle_evq_param));
51 evq_params.socket_id = socket_id;
52 evq_params.max_events = max_events;
55 virtual void TearDown(void)
60 class udp_event : public ::udp_evq {
64 struct tle_event *event;
66 virtual void SetUp(void)
69 evq = tle_evq_create(&evq_params);
70 ASSERT_NE(evq, (struct tle_evq *) NULL);
71 EXPECT_EQ(rte_errno, 0);
74 virtual void TearDown(void)
80 class udp_event_state : public ::udp_event {
83 virtual void SetUp(void)
86 event = tle_event_alloc(evq, (void *) &fake_data);
87 ASSERT_NE(event, (struct tle_event *) NULL);
90 virtual void TearDown(void)
92 tle_event_free(event);
93 udp_event::TearDown();
97 struct udp_event_state_active : ::udp_event_state,
98 testing::WithParamInterface < event_state_active > {
99 udp_event_state_active() {}
102 struct udp_event_state_active_twice : ::udp_event_state,
103 testing::WithParamInterface < event_state_active_twice > {
104 udp_event_state_active_twice() {}
107 struct udp_event_state_idle : ::udp_event_state_active {
110 #endif /* TEST_TLE_UDP_EVENT_H_ */