memgraph/tests/unit/utils_exceptions.cpp
antonio2368 28413fd626 Change log library to spdlog, expose log levels to user (#72)
* Change from glog to spdlog

* Remove HA tests

* Remove logrotate log configuration

* Define custom main for unit gtests
2021-01-21 16:30:55 +01:00

22 lines
564 B
C++

#include <gtest/gtest.h>
#include <utils/exceptions.hpp>
void i_will_throw() { throw utils::BasicException("this is not ok"); }
void bar() { i_will_throw(); }
void foo() { bar(); }
void i_will_throw_stacktrace_exception() {
throw utils::StacktraceException("this is not {}", "ok!");
}
void bar_stacktrace() { i_will_throw_stacktrace_exception(); }
void foo_stacktrace() { bar_stacktrace(); }
TEST(ExceptionsTest, ThrowBasicAndStackExceptions) {
ASSERT_THROW(foo(), utils::BasicException);
ASSERT_THROW(foo_stacktrace(), utils::StacktraceException);
}