clean-up example
This commit is contained in:
parent
e500bdade0
commit
ebc3c197ef
1 changed files with 3 additions and 15 deletions
|
@ -53,7 +53,7 @@ int somevar;
|
||||||
|
|
||||||
enum class Color { RED, GREEN, BLUE };
|
enum class Color { RED, GREEN, BLUE };
|
||||||
|
|
||||||
void TestCase1() {
|
int main() {
|
||||||
SomeStruct somevar;
|
SomeStruct somevar;
|
||||||
Long othervar;
|
Long othervar;
|
||||||
int intvar;
|
int intvar;
|
||||||
|
@ -102,10 +102,8 @@ void TestCase1() {
|
||||||
std::cout << NAMEOF_FULL(&SomeStruct::SomeMethod2) << std::endl; // &SomeStruct::SomeMethod2
|
std::cout << NAMEOF_FULL(&SomeStruct::SomeMethod2) << std::endl; // &SomeStruct::SomeMethod2
|
||||||
std::cout << NAMEOF_FULL(Long::LL) << std::endl; // Long::LL
|
std::cout << NAMEOF_FULL(Long::LL) << std::endl; // Long::LL
|
||||||
std::cout << NAMEOF_FULL(std::string) << std::endl; // std::string
|
std::cout << NAMEOF_FULL(std::string) << std::endl; // std::string
|
||||||
}
|
|
||||||
|
|
||||||
void TestCase2() {
|
const auto div = [](int x, int y) -> int {
|
||||||
const auto div = [](int x, int y) {
|
|
||||||
if (y == 0) {
|
if (y == 0) {
|
||||||
throw std::invalid_argument(std::string(NAMEOF(y)).append(" should not be zero!"));
|
throw std::invalid_argument(std::string(NAMEOF(y)).append(" should not be zero!"));
|
||||||
}
|
}
|
||||||
|
@ -118,18 +116,8 @@ void TestCase2() {
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cout << e.what() << std::endl; // y should not be zero!
|
std::cout << e.what() << std::endl; // y should not be zero!
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void TestCase3() {
|
std::cout << NAMEOF(main) << " method entry" << std::endl; // main method entry
|
||||||
std::cout << NAMEOF(TestCase3) << " method entry" << std::endl; // TestCase3 method entry
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
TestCase1();
|
|
||||||
|
|
||||||
TestCase2();
|
|
||||||
|
|
||||||
TestCase3();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue