1 /* 2 * Copyright 2021 Google LLC 3 * SPDX-License-Identifier: Apache-2.0 4 */ 5 6 #include <zephyr/device.h> 7 #include <zephyr/drivers/emul.h> 8 #include <zephyr/ztest.h> 9 10 #include "fixture.h" 11 12 ZTEST_SUITE(generic, NULL, NULL, NULL, NULL, NULL); 13 get_and_check_emul(const struct device * dev)14const struct emul *get_and_check_emul(const struct device *dev) 15 { 16 zassert_not_null(dev, "Cannot get device pointer. Is this driver properly instantiated?"); 17 18 const struct emul *emul = emul_get_binding(dev->name); 19 20 /* Skip this sensor if there is no emulator or backend loaded. */ 21 if (emul == NULL || emul->backend_api == NULL) { 22 ztest_test_skip(); 23 } 24 return emul; 25 } 26