/
jiteman
/
jsd-foreign-libreoffice-cppunit
Обзор
Документация
Войти
/
jiteman
/
jsd-foreign-libreoffice-cppunit
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
examples/cppunittest/TestFailureTest.cpp
70 строк
1 KB
jiteman
initial commit has been done
14 апр 2024, 15:49
14 апр 2024, 15:49
4c53812
Код
Авторство
О чём код?
#include "CoreSuite.h" #include "TestFailureTest.h" #include <cppunit/TestFailure.h> #include <cppunit/Exception.h> CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestFailureTest, coreSuiteName() ); TestFailureTest::TestFailureTest() { } TestFailureTest::~TestFailureTest() { } void TestFailureTest::setUp() { m_exceptionDestroyed = false; } void TestFailureTest::tearDown() { } void TestFailureTest::testConstructorAndGetters() { CPPUNIT_NS::TestCase test; CPPUNIT_NS::Exception *error = new ObservedException( this ); checkTestFailure( &test, error, false ); CPPUNIT_ASSERT( m_exceptionDestroyed ); } void TestFailureTest::testConstructorAndGettersForError() { CPPUNIT_NS::TestCase test; CPPUNIT_NS::Exception *error = new ObservedException( this ); checkTestFailure( &test, error, true ); CPPUNIT_ASSERT( m_exceptionDestroyed ); } void TestFailureTest::exceptionDestroyed() { m_exceptionDestroyed = true; } void TestFailureTest::checkTestFailure( CPPUNIT_NS::Test *test, CPPUNIT_NS::Exception *error, bool isError ) { CPPUNIT_NS::TestFailure failure( test, error, isError ); CPPUNIT_ASSERT_EQUAL( test, failure.failedTest() ); CPPUNIT_ASSERT_EQUAL( error, failure.thrownException() ); CPPUNIT_ASSERT_EQUAL( isError, failure.isError() ); }