Newer
Older
snipet / libscpp / trunk / unittest / src / ut_exception.cpp
Nomura Kei on 26 Aug 2022 908 bytes old svn data to git
#include <string>

#include <scpp_os.hpp>
#include <scpp_unittest.hpp>
#include <scpp_exception.hpp>

using namespace scpp;


/***
 * Exception 単体テスト.
 */
class ExceptionTest : public TestCase
{
	public:
		ExceptionTest() {}
		~ExceptionTest() {}

		void testThrowable()
		{
			Throwable t1;
			Throwable t2("msg");
			Throwable t3 = t1;
			t3.what();
			std::string msg = t2.what();
			Assertion::assertEquals("msg", msg);
			
		}

		void testException()
		{
			Exception t1;
			Exception t2("msg");
			Exception t3 = t1;
			t3.what();
			std::string msg = t2.what();
			Assertion::assertEquals("msg", msg);
			
		}

		void testError()
		{
			Error t1;
			Error t2("msg");
			Error t3 = t1;
			t3.what();
			std::string msg = t2.what();
			Assertion::assertEquals("msg", msg);
			
		}


		void suite()
		{
			RUN_TEST(testThrowable);
			RUN_TEST(testException);
			RUN_TEST(testError);

		}


};