forked from pEp.foundation/CXX-project-template
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
// This file is under GNU General Public License 3.0
|
|
// see LICENSE.txt
|
|
#include "hello_world.hh"
|
|
#include <iostream>
|
|
|
|
// 2 Reasons why this 'using namespace' is okay
|
|
// 1. We cannot put main() in the namespace pEp,
|
|
// 2. If we were to extract parts of this file into a header-extension (hxx) as a template function/class
|
|
// we would be in the namespace pEp anyways.
|
|
using namespace pEp;
|
|
|
|
int main()
|
|
{
|
|
std::cout << "Test Hello World" << std::endl;
|
|
{
|
|
std::cout << "Test non-template func" << std::endl;
|
|
std::string ret = HelloWorld::hello_world();
|
|
std::cout << ret << std::endl;
|
|
assert(ret == "hello world");
|
|
}
|
|
|
|
{
|
|
std::cout << "Test invoke generated template for std::string" << std::endl;
|
|
std::string ret = HelloWorld::hello_world("pEp");
|
|
std::cout << ret << std::endl;
|
|
assert(ret == "pEp");
|
|
}
|
|
|
|
{
|
|
std::cout << "Test specialization for int" << std::endl;
|
|
int ret = HelloWorld::hello_world(404);
|
|
std::cout << ret << std::endl;
|
|
assert(ret == 808);
|
|
}
|
|
|
|
{
|
|
std::cout << "Test specialization for double" << std::endl;
|
|
double ret = HelloWorld::hello_world(4.04);
|
|
std::cout << ret << std::endl;
|
|
assert(ret == 8.08);
|
|
}
|
|
std::cout << "All tests passed" << std::endl;
|
|
return 0;
|
|
}
|
|
|