test-invalid-enum.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 //#cmake:add-file log-common.h
5 #include "log-common.h"
6 
7 
8 TEST_CASE( "Logging with invalid enum", "[log]" ) {
9 
10  size_t n_callbacks = 0;
11  auto callback = [&]( rs2_log_severity severity, rs2::log_message const& msg )
12  {
13  ++n_callbacks;
14  TRACE( severity << ' ' << msg.filename() << '+' << msg.line_number() << ": " << msg.raw() );
15  };
16 
18  REQUIRE( !n_callbacks );
19  REQUIRE_THROWS( rs2::log( rs2_log_severity( 10 ), "10" ) ); // Throws recoverable_exception, which will issue a log by itself!
20  REQUIRE_THROWS( rs2::log( rs2_log_severity( -1 ), "-1" ) ); // 'invalid enum value for argument "severity"'
21  REQUIRE( n_callbacks == 2 );
22 }
GLenum GLuint GLenum severity
void log_to_callback(rs2_log_severity min_severity, S callback)
Definition: rs.hpp:139
void log(rs2_log_severity severity, const char *message)
Definition: rs.hpp:149
TEST_CASE("Logging with invalid enum","[log]")
REQUIRE(n_callbacks==1)
#define REQUIRE_THROWS(...)
Definition: catch.hpp:17401
def callback(frame)
Definition: t265_stereo.py:91
rs2_log_severity
Severity of the librealsense logger.
Definition: rs_types.h:153


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:11