Lines Matching +full:self +full:- +full:test
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 // self-id-sequence-helper-test.c - An application of Kunit to test helpers of self ID sequence.
7 #include <kunit/test.h>
9 #include "phy-packet-definitions.h"
11 static void test_self_id_sequence_enumerator_valid(struct kunit *test) in test_self_id_sequence_enumerator_valid() argument
27 KUNIT_EXPECT_PTR_EQ(test, entry, &valid_sequences[0]); in test_self_id_sequence_enumerator_valid()
28 KUNIT_EXPECT_EQ(test, quadlet_count, 1); in test_self_id_sequence_enumerator_valid()
29 KUNIT_EXPECT_EQ(test, enumerator.quadlet_count, 6); in test_self_id_sequence_enumerator_valid()
32 KUNIT_EXPECT_PTR_EQ(test, entry, &valid_sequences[1]); in test_self_id_sequence_enumerator_valid()
33 KUNIT_EXPECT_EQ(test, quadlet_count, 2); in test_self_id_sequence_enumerator_valid()
34 KUNIT_EXPECT_EQ(test, enumerator.quadlet_count, 4); in test_self_id_sequence_enumerator_valid()
37 KUNIT_EXPECT_PTR_EQ(test, entry, &valid_sequences[3]); in test_self_id_sequence_enumerator_valid()
38 KUNIT_EXPECT_EQ(test, quadlet_count, 3); in test_self_id_sequence_enumerator_valid()
39 KUNIT_EXPECT_EQ(test, enumerator.quadlet_count, 1); in test_self_id_sequence_enumerator_valid()
42 KUNIT_EXPECT_PTR_EQ(test, entry, &valid_sequences[6]); in test_self_id_sequence_enumerator_valid()
43 KUNIT_EXPECT_EQ(test, quadlet_count, 1); in test_self_id_sequence_enumerator_valid()
44 KUNIT_EXPECT_EQ(test, enumerator.quadlet_count, 0); in test_self_id_sequence_enumerator_valid()
47 KUNIT_EXPECT_EQ(test, PTR_ERR(entry), -ENODATA); in test_self_id_sequence_enumerator_valid()
50 static void test_self_id_sequence_enumerator_invalid(struct kunit *test) in test_self_id_sequence_enumerator_invalid() argument
63 KUNIT_EXPECT_EQ(test, PTR_ERR(entry), -EPROTO); in test_self_id_sequence_enumerator_invalid()
66 static void test_self_id_sequence_get_port_status(struct kunit *test) in test_self_id_sequence_get_port_status() argument
84 KUNIT_ASSERT_EQ(test, ARRAY_SIZE(expected), ARRAY_SIZE(quadlets)); in test_self_id_sequence_get_port_status()
88 KUNIT_ASSERT_EQ(test, port_capacity, ARRAY_SIZE(port_status)); in test_self_id_sequence_get_port_status()
97 // Self ID zero. in test_self_id_sequence_get_port_status()
98 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[0]); in test_self_id_sequence_get_port_status()
99 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[1]); in test_self_id_sequence_get_port_status()
100 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[2]); in test_self_id_sequence_get_port_status()
102 // Self ID one. in test_self_id_sequence_get_port_status()
103 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[3]); in test_self_id_sequence_get_port_status()
104 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[4]); in test_self_id_sequence_get_port_status()
105 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[5]); in test_self_id_sequence_get_port_status()
106 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[6]); in test_self_id_sequence_get_port_status()
107 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[7]); in test_self_id_sequence_get_port_status()
108 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[8]); in test_self_id_sequence_get_port_status()
109 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[9]); in test_self_id_sequence_get_port_status()
110 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[10]); in test_self_id_sequence_get_port_status()
112 // Self ID two. in test_self_id_sequence_get_port_status()
113 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[11]); in test_self_id_sequence_get_port_status()
114 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[12]); in test_self_id_sequence_get_port_status()
115 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[13]); in test_self_id_sequence_get_port_status()
116 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[14]); in test_self_id_sequence_get_port_status()
117 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[15]); in test_self_id_sequence_get_port_status()
118 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[16]); in test_self_id_sequence_get_port_status()
119 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[17]); in test_self_id_sequence_get_port_status()
120 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[18]); in test_self_id_sequence_get_port_status()
122 // Self ID three. in test_self_id_sequence_get_port_status()
123 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[19]); in test_self_id_sequence_get_port_status()
124 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[20]); in test_self_id_sequence_get_port_status()
125 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[21]); in test_self_id_sequence_get_port_status()
126 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[22]); in test_self_id_sequence_get_port_status()
127 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[23]); in test_self_id_sequence_get_port_status()
128 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_CHILD, port_status[24]); in test_self_id_sequence_get_port_status()
129 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_PARENT, port_status[25]); in test_self_id_sequence_get_port_status()
130 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NCONN, port_status[26]); in test_self_id_sequence_get_port_status()
133 KUNIT_EXPECT_EQ(test, PHY_PACKET_SELF_ID_PORT_STATUS_NONE, port_status[27]); in test_self_id_sequence_get_port_status()
135 KUNIT_EXPECT_MEMEQ(test, quadlets, expected, sizeof(expected)); in test_self_id_sequence_get_port_status()
146 .name = "self-id-sequence-helper",
151 MODULE_DESCRIPTION("Unit test suite for helpers of self ID sequence");