PageRenderTime 26ms CodeModel.GetById 18ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/test/unit/testArguments.cpp

https://github.com/deltaforge/nebu-common-cpp
C++ | 29 lines | 22 code | 6 blank | 1 comment | 0 complexity | 81b466e38b818c54afe5c421eef04afa MD5 | raw file
 1
 2#include "gtest/gtest.h"
 3#include "gmock/gmock.h"
 4
 5#include "nebu/util/arguments.h"
 6
 7// Using declarations - nebu-common
 8using nebu::common::Arguments;
 9using nebu::common::IllegalArgumentException;
10
11TEST(ArgumentTest, testThrowsIfNullWithNull) {
12	try {
13		NEBU_THROWIFNULL(NULL);
14		FAIL() << "Expected IllegalArgumentException";
15	} catch (IllegalArgumentException &expected) {
16		SUCCEED();
17	}
18}
19
20TEST(ArgumentTest, testThrowsIfNullWithGoodValue) {
21	int someValue = 0;
22	int *somePointer = &someValue;
23	NEBU_THROWIFNULL(somePointer);
24}
25
26int main(int argc, char **argv) {
27	testing::InitGoogleMock(&argc, argv);
28	return RUN_ALL_TESTS();
29}