4 #if !defined(MAKEFILE) || ( defined(OFFLINE_TEST) ) 6 #define CATCH_CONFIG_MAIN 10 #include "../src/device.h" 21 TEST_CASE(
"wraparound_mechanism produces correct output",
"[offline] [validation]")
23 auto unsigned_short_max = std::numeric_limits<uint16_t>::max();
26 unsigned long long last_number = 65532;
27 for (
unsigned i = 65533; last_number < unsigned_short_max * 5; ++i)
29 if (i > unsigned_short_max)
32 auto new_number = wm.
fix(i);
33 REQUIRE((new_number - last_number) == 1);
34 last_number = new_number;
38 TEST_CASE(
"rs_create_context() validates input",
"[offline] [validation]" )
47 TEST_CASE(
"rs_delete_context() validates input",
"[offline] [validation]" )
52 TEST_CASE(
"rs_get_device_count() validates input",
"[offline] [validation]" )
57 TEST_CASE(
"rs_get_device() validates input",
"[offline] [validation]" )
65 TEST_CASE(
"rs_get_device_name() validates input",
"[offline] [validation]" )
70 TEST_CASE(
"rs_get_device_serial() validates input",
"[offline] [validation]" )
75 TEST_CASE(
"rs_get_device_firmware_version() validates input",
"[offline] [validation]" )
80 TEST_CASE(
"rs_get_device_extrinsics() validates input",
"[offline] [validation]" )
94 TEST_CASE(
"rs_get_device_depth_scale() validates input",
"[offline] [validation]" )
99 TEST_CASE(
"rs_device_supports_option() validates input",
"[offline] [validation]" )
107 TEST_CASE(
"rs_get_stream_mode_count() validates input",
"[offline] [validation]" )
115 TEST_CASE(
"rs_get_stream_mode() validates input",
"[offline] [validation]" )
129 TEST_CASE(
"rs_enable_stream() validates input",
"[offline] [validation]" )
150 TEST_CASE(
"rs_enable_stream_preset() validates input",
"[offline] [validation]" )
161 TEST_CASE(
"rs_disable_stream() validates input",
"[offline] [validation]" )
169 TEST_CASE(
"rs_is_stream_enabled() validates input",
"[offline] [validation]" )
177 TEST_CASE(
"rs_get_stream_intrinsics() validates input",
"[offline] [validation]" )
188 TEST_CASE(
"rs_get_stream_format() validates input",
"[offline] [validation]" )
196 TEST_CASE(
"rs_get_stream_framerate() validates input",
"[offline] [validation]" )
204 TEST_CASE(
"rs_start_device() validates input",
"[offline] [validation]" )
209 TEST_CASE(
"rs_stop_device() validates input",
"[offline] [validation]" )
214 TEST_CASE(
"rs_is_device_streaming() validates input",
"[offline] [validation]" )
219 TEST_CASE(
"rs_set_device_option() validates input",
"[offline] [validation]" )
230 TEST_CASE(
"rs_get_device_option() validates input",
"[offline] [validation]" )
238 TEST_CASE(
"rs_wait_for_frames() validates input",
"[offline] [validation]" )
243 TEST_CASE(
"rs_get_frame_timestamp() validates input",
"[offline] [validation]" )
251 TEST_CASE(
"rs_get_frame_data() validates input",
"[offline] [validation]" )
259 TEST_CASE(
"rs_free_error() gracefully handles invalid input",
"[offline] [validation]" )
265 TEST_CASE(
"rs_get_failed_function() gracefully handles invalid input",
"[offline] [validation]" )
270 TEST_CASE(
"rs_get_failed_args() gracefully handles invalid input",
"[offline] [validation]" )
275 TEST_CASE(
"rs_get_error_message() gracefully handles invalid input",
"[offline] [validation]" )
280 TEST_CASE(
"rs_stream_to_string() produces correct output",
"[offline] [validation]" )
297 TEST_CASE(
"rs_format_to_string() produces correct output",
"[offline] [validation]" )
317 TEST_CASE(
"rs_preset_to_string() produces correct output",
"[offline] [validation]" )
329 TEST_CASE(
"rs_distortion_to_string() produces correct output",
"[offline] [validation]" )
341 TEST_CASE(
"rs_option_to_string() produces correct output",
"[offline] [validation]" )
379 TEST_CASE(
"rs_create_context() returns a valid context",
"[offline] [validation]" )
385 TEST_CASE(
"rs_context has singleton semantics",
"[offline] [validation]" )
392 TEST_CASE(
"rs API version verification",
"[offline] [validation]")
396 std::cout <<
"Librealsense API version number is " <<
RS_API_VERSION << std::endl;
403 REQUIRE(api_ver_str.size() >= 5);
404 REQUIRE(api_ver_str.size() <= 8);
const char * rs_stream_to_string(rs_stream stream)
int rs_get_device_count(const rs_context *context, rs_error **error)
Determines number of connected devices.
GLint GLint GLsizei GLsizei height
double rs_get_frame_timestamp(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves time at which the latest frame on a stream was captured.
const void * rs_get_frame_data(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the contents of the latest frame on a stream.
int rs_is_device_streaming(const rs_device *device, rs_error **error)
Determines if the device is currently streaming.
GLsizei const GLchar *const * string
const char * rs_distortion_to_string(rs_distortion distortion)
TEST_CASE("wraparound_mechanism produces correct output","[offline] [validation]")
const char * rs_get_device_name(const rs_device *device, rs_error **error)
Retrieves human-readable device model string.
rs_option
Defines general configuration controls.
const char * rs_get_error_message(const rs_error *error)
Returns static pointer to error message.
float rs_get_device_depth_scale(const rs_device *device, rs_error **error)
Retrieves mapping between the units of the depth image and meters.
int rs_get_stream_mode_count(const rs_device *device, rs_stream stream, rs_error **error)
Determines the number of streaming modes available for a given stream.
rs_get_stream_mode(nullptr, RS_STREAM_DEPTH, 0,&width,&height,&format,&framerate, require_error("null pointer passed for argument \"device\""))
rs_get_device_extrinsics(nullptr, RS_STREAM_DEPTH, RS_STREAM_COLOR,&extrin, require_error("null pointer passed for argument \"device\""))
const char * rs_get_failed_function(const rs_error *error)
Returns static pointer to name of a failing function in case of error.
REQUIRE(rs_create_context(RS_API_VERSION+100, require_error("", false))==nullptr)
rs_format rs_get_stream_format(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the pixel format for a specific stream.
rs_context * rs_create_context(int api_version, rs_error **error)
Creates RealSense context that is required for the rest of the API.
double rs_get_device_option(rs_device *device, rs_option option, rs_error **error)
Retrieves the current value of a single option.
int rs_device_supports_option(const rs_device *device, rs_option option, rs_error **error)
Determines if the device allows a specific option to be queried and set.
const char * rs_get_device_firmware_version(const rs_device *device, rs_error **error)
Retrieves the version of the firmware currently installed on the device.
const char * rs_get_failed_args(const rs_error *error)
Returns static pointer to arguments of a failing function in case of error.
rs_delete_context(ctx, require_no_error())
rs_format
Formats: defines how each stream can be encoded.
rs_disable_stream(fake_object_pointer(),(rs_stream)-1, require_error("bad enum value for argument \"stream\""))
const auto RS_FORMAT_MAX_ENUM
void rs_free_error(rs_error *error)
Frees memory of an error object.
rs_enable_stream_preset(fake_object_pointer(),(rs_stream)-1, RS_PRESET_BEST_QUALITY, require_error("bad enum value for argument \"stream\""))
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
const char * rs_preset_to_string(rs_preset preset)
rs_preset
Presets: general preferences that are translated by librealsense into concrete resolution and FPS...
int rs_get_stream_framerate(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the frame rate for a specific stream.
const char * rs_format_to_string(rs_format format)
rs_stream
Streams are different types of data provided by RealSense devices.
GLint GLint GLsizei width
const char * rs_option_to_string(rs_option option)
rs_device * rs_get_device(rs_context *context, int index, rs_error **error)
Retrieves connected device by index.
const char * rs_get_device_serial(const rs_device *device, rs_error **error)
Retrieves unique serial number of the device.
void rs_wait_for_frames(rs_device *device, rs_error **error)
Blocks until new frames are available.
rs_set_device_option(fake_object_pointer(),(rs_option)-1, 100, require_error("bad enum value for argument \"option\""))
#define RS_API_VERSION_STR
rs_distortion
Distortion model: defines how pixel coordinates should be mapped to sensor coordinates.
void rs_start_device(rs_device *device, rs_error **error)
Begins streaming on all enabled streams for this device.
void rs_stop_device(rs_device *device, rs_error **error)
Ends data acquisition for the specified source providers.
int rs_is_stream_enabled(const rs_device *device, rs_stream stream, rs_error **error)
Determines if a specific stream is enabled.
rs_get_stream_intrinsics(nullptr, RS_STREAM_DEPTH,&intrin, require_error("null pointer passed for argument \"device\""))
static std::string unknown
rs_enable_stream(fake_object_pointer(),(rs_stream)-1, 640, 480, RS_FORMAT_Z16, 60, require_error("bad enum value for argument \"stream\""))
const auto RS_STREAM_MAX_ENUM