tests: Add test boilerplate for our homegrown demanglers.
There's only one test each, for now, but adding tests is now of course a one-line addition per test.
This commit is contained in:
parent
48a6df083d
commit
8339f2eb89
57
src/tests/add-ons/kernel/debugger/DemangleTest.cpp
Normal file
57
src/tests/add-ons/kernel/debugger/DemangleTest.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2018, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include "DemangleTest.h"
|
||||
|
||||
#include <cppunit/TestCaller.h>
|
||||
#include <cppunit/TestSuite.h>
|
||||
|
||||
#include "Demangler.h"
|
||||
|
||||
|
||||
DemangleTest::DemangleTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DemangleTest::~DemangleTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#define TEST(expect, input) \
|
||||
NextSubTest(); \
|
||||
CPPUNIT_ASSERT_EQUAL(BString(expect), Demangler::Demangle(input))
|
||||
void
|
||||
DemangleTest::RunGCC2Tests()
|
||||
{
|
||||
TEST("", "()");
|
||||
TEST("BPrivate::IconCache::SyncDraw(BPrivate::Model*, BView*, BPoint, BPrivate::IconDrawMode, icon_size, void*, void*)",
|
||||
"SyncDraw__Q28BPrivate9IconCachePQ28BPrivate5ModelP5BViewG6BPointQ28BPrivate12IconDrawMode9icon_sizePFP5BViewG6BPointP7BBitmapPv_vPv");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DemangleTest::RunGCC3PTests()
|
||||
{
|
||||
TEST("BPrivate::IconCache::SyncDraw(BPrivate::Model*, BView*, BPoint, BPrivate::IconDrawMode, icon_size, void (*)(BView*, BPoint, BBitmap*, void*), void*)",
|
||||
"_ZN8BPrivate9IconCache8SyncDrawEPNS_5ModelEP5BView6BPointNS_12IconDrawModeE9icon_sizePFvS4_S5_P7BBitmapPvESA_");
|
||||
}
|
||||
#undef TEST
|
||||
|
||||
|
||||
/* static */ void
|
||||
DemangleTest::AddTests(BTestSuite& parent)
|
||||
{
|
||||
CppUnit::TestSuite& suite = *new CppUnit::TestSuite("DemangleTest");
|
||||
|
||||
suite.addTest(new CppUnit::TestCaller<DemangleTest>(
|
||||
"DemangleTest::RunGCC2Tests", &DemangleTest::RunGCC2Tests));
|
||||
suite.addTest(new CppUnit::TestCaller<DemangleTest>(
|
||||
"DemangleTest::RunGCC3+Tests", &DemangleTest::RunGCC3PTests));
|
||||
|
||||
parent.addTest("DemangleTest", &suite);
|
||||
}
|
25
src/tests/add-ons/kernel/debugger/DemangleTest.h
Normal file
25
src/tests/add-ons/kernel/debugger/DemangleTest.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2018, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef DEMANGLE_TEST
|
||||
#define DEMANGLE_TEST
|
||||
|
||||
|
||||
#include <TestCase.h>
|
||||
#include <TestSuite.h>
|
||||
|
||||
|
||||
class DemangleTest : public BTestCase {
|
||||
public:
|
||||
DemangleTest();
|
||||
virtual ~DemangleTest();
|
||||
|
||||
void RunGCC2Tests();
|
||||
void RunGCC3PTests();
|
||||
|
||||
static void AddTests(BTestSuite& suite);
|
||||
};
|
||||
|
||||
|
||||
#endif // DEMANGLE_TEST
|
@ -1,9 +1,13 @@
|
||||
SubDir HAIKU_TOP src tests add-ons kernel debugger ;
|
||||
|
||||
UsePrivateKernelHeaders ;
|
||||
UsePrivateHeaders shared ;
|
||||
SubDirHdrs $(HAIKU_TOP) src kits debugger demangler ;
|
||||
|
||||
SubDirHdrs $(HAIKU_TOP) src add-ons kernel debugger demangle ;
|
||||
UnitTestLib libkerneldebuggertest.so :
|
||||
KernelDebuggerTest.cpp
|
||||
|
||||
SimpleTest gcc2_demangle_test : gcc2_demangle_test.cpp ;
|
||||
DemangleTest.cpp
|
||||
|
||||
: <nogrist>Debugger_demangler.o
|
||||
be [ TargetLibstdc++ ] [ TargetLibsupc++ ]
|
||||
;
|
||||
|
||||
|
22
src/tests/add-ons/kernel/debugger/KernelDebuggerTest.cpp
Normal file
22
src/tests/add-ons/kernel/debugger/KernelDebuggerTest.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2018, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <TestSuite.h>
|
||||
#include <TestSuiteAddon.h>
|
||||
|
||||
#include "DemangleTest.h"
|
||||
|
||||
|
||||
BTestSuite*
|
||||
getTestSuite()
|
||||
{
|
||||
BTestSuite* suite = new BTestSuite("KernelDebuggerTest");
|
||||
|
||||
DemangleTest::AddTests(*suite);
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user