Lines Matching refs:fixture
36 struct bc12_pd_mode_fixture *fixture = user_data; in bc12_test_result_cb() local
38 fixture->callback_count++; in bc12_test_result_cb()
48 fixture->partner_state = *state; in bc12_test_result_cb()
51 fixture->disconnect_detected = true; in bc12_test_result_cb()
52 fixture->partner_state.type = BC12_TYPE_NONE; in bc12_test_result_cb()
53 fixture->partner_state.current_ua = 0; in bc12_test_result_cb()
54 fixture->partner_state.voltage_uv = 0; in bc12_test_result_cb()
60 bc12_emul_set_charging_partner(fixture->bc12_emul, BC12_TYPE_NONE); in ZTEST_USER_F()
62 bc12_set_role(fixture->bc12_dev, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
67 zassert_equal(fixture->callback_count, 0); in ZTEST_USER_F()
73 bc12_emul_set_charging_partner(fixture->bc12_emul, BC12_TYPE_SDP); in ZTEST_USER_F()
76 bc12_set_role(fixture->bc12_dev, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
87 zassert_equal(fixture->callback_count, 1); in ZTEST_USER_F()
88 zassert_equal(fixture->partner_state.bc12_role, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
89 zassert_equal(fixture->partner_state.type, BC12_TYPE_SDP); in ZTEST_USER_F()
90 zassert_equal(fixture->partner_state.current_ua, 2500); in ZTEST_USER_F()
91 zassert_equal(fixture->partner_state.voltage_uv, 5000 * 1000); in ZTEST_USER_F()
94 fixture->callback_count = 0; in ZTEST_USER_F()
95 bc12_emul_set_charging_partner(fixture->bc12_emul, BC12_TYPE_NONE); in ZTEST_USER_F()
98 bc12_set_role(fixture->bc12_dev, BC12_DISCONNECTED); in ZTEST_USER_F()
103 zassert_equal(fixture->callback_count, 1); in ZTEST_USER_F()
104 zassert_equal(fixture->partner_state.type, BC12_TYPE_NONE); in ZTEST_USER_F()
105 zassert_equal(fixture->partner_state.current_ua, 0); in ZTEST_USER_F()
106 zassert_equal(fixture->partner_state.voltage_uv, 0); in ZTEST_USER_F()
111 bc12_emul_set_charging_partner(fixture->bc12_emul, BC12_TYPE_CDP); in ZTEST_USER_F()
113 bc12_set_role(fixture->bc12_dev, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
117 zassert_equal(fixture->callback_count, 1); in ZTEST_USER_F()
118 zassert_equal(fixture->partner_state.bc12_role, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
119 zassert_equal(fixture->partner_state.type, BC12_TYPE_CDP); in ZTEST_USER_F()
120 zassert_equal(fixture->partner_state.current_ua, 1500 * 1000); in ZTEST_USER_F()
121 zassert_equal(fixture->partner_state.voltage_uv, 5000 * 1000); in ZTEST_USER_F()
124 fixture->callback_count = 0; in ZTEST_USER_F()
125 bc12_emul_set_charging_partner(fixture->bc12_emul, BC12_TYPE_NONE); in ZTEST_USER_F()
128 bc12_set_role(fixture->bc12_dev, BC12_DISCONNECTED); in ZTEST_USER_F()
133 zassert_equal(fixture->callback_count, 1); in ZTEST_USER_F()
134 zassert_true(fixture->disconnect_detected); in ZTEST_USER_F()
135 zassert_equal(fixture->partner_state.type, BC12_TYPE_NONE); in ZTEST_USER_F()
136 zassert_equal(fixture->partner_state.current_ua, 0); in ZTEST_USER_F()
137 zassert_equal(fixture->partner_state.voltage_uv, 0); in ZTEST_USER_F()
142 bc12_emul_set_charging_partner(fixture->bc12_emul, BC12_TYPE_SDP); in ZTEST_USER_F()
144 bc12_set_role(fixture->bc12_dev, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
148 zassert_equal(fixture->callback_count, 1); in ZTEST_USER_F()
149 zassert_equal(fixture->partner_state.bc12_role, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
150 zassert_equal(fixture->partner_state.type, BC12_TYPE_SDP); in ZTEST_USER_F()
151 zassert_equal(fixture->partner_state.current_ua, 2500); in ZTEST_USER_F()
152 zassert_equal(fixture->partner_state.voltage_uv, 5000 * 1000); in ZTEST_USER_F()
155 fixture->callback_count = 0; in ZTEST_USER_F()
156 bc12_emul_set_charging_partner(fixture->bc12_emul, BC12_TYPE_DCP); in ZTEST_USER_F()
159 bc12_set_role(fixture->bc12_dev, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
164 zassert_equal(fixture->callback_count, 1); in ZTEST_USER_F()
165 zassert_equal(fixture->partner_state.bc12_role, BC12_PORTABLE_DEVICE); in ZTEST_USER_F()
166 zassert_equal(fixture->partner_state.type, BC12_TYPE_DCP); in ZTEST_USER_F()
167 zassert_equal(fixture->partner_state.current_ua, 1500 * 1000); in ZTEST_USER_F()
168 zassert_equal(fixture->partner_state.voltage_uv, 5000 * 1000); in ZTEST_USER_F()
173 struct bc12_pd_mode_fixture *fixture = data; in bc12_before() local
175 fixture->callback_count = 0; in bc12_before()
176 fixture->disconnect_detected = 0; in bc12_before()
177 memset(&fixture->partner_state, 0, sizeof(struct bc12_partner_state)); in bc12_before()
179 bc12_set_result_cb(fixture->bc12_dev, &bc12_test_result_cb, fixture); in bc12_before()
184 struct bc12_pd_mode_fixture *fixture = data; in bc12_after() local
186 bc12_set_result_cb(fixture->bc12_dev, NULL, NULL); in bc12_after()
187 bc12_set_role(fixture->bc12_dev, BC12_DISCONNECTED); in bc12_after()
192 static struct bc12_pd_mode_fixture fixture = { in bc12_setup() local
197 zassert_not_null(fixture.bc12_dev); in bc12_setup()
198 zassert_not_null(fixture.bc12_emul); in bc12_setup()
199 zassert_true(device_is_ready(fixture.bc12_dev)); in bc12_setup()
201 return &fixture; in bc12_setup()