Skip to content

Commit 2703808

Browse files
committed
------------------------------------------------------------------------
r205 | cnicholson | 2009-02-01 22:50:16 -0600 (Sun, 01 Feb 2009) | 2 lines - TimeHelpers reports fractions of msec, though time constraint is still on integers. - compile fixes for more strict gcc warnings. ------------------------------------------------------------------------
1 parent d6ba794 commit 2703808

13 files changed

+570
-540
lines changed

Makefile

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,96 @@
1-
CXX = g++
2-
CXXFLAGS ?= -g -Wall -W -ansi # -pedantic
3-
LDFLAGS ?=
4-
SED = sed
5-
MV = mv
6-
RM = rm
7-
8-
.SUFFIXES: .o .cpp
9-
10-
lib = libUnitTest++.a
11-
test = TestUnitTest++
12-
13-
src = src/AssertException.cpp \
14-
src/Test.cpp \
15-
src/Checks.cpp \
16-
src/TestRunner.cpp \
17-
src/TestResults.cpp \
18-
src/TestReporter.cpp \
19-
src/TestReporterStdout.cpp \
20-
src/ReportAssert.cpp \
21-
src/TestList.cpp \
22-
src/TimeConstraint.cpp \
23-
src/TestDetails.cpp \
24-
src/MemoryOutStream.cpp \
25-
src/DeferredTestReporter.cpp \
26-
src/DeferredTestResult.cpp \
27-
src/XmlTestReporter.cpp \
28-
src/CurrentTest.cpp
29-
30-
ifeq ($(MSYSTEM), MINGW32)
31-
src += src/Win32/TimeHelpers.cpp
32-
else
33-
src += src/Posix/SignalTranslator.cpp \
34-
src/Posix/TimeHelpers.cpp
35-
endif
36-
37-
test_src = src/tests/Main.cpp \
38-
src/tests/TestAssertHandler.cpp \
39-
src/tests/TestChecks.cpp \
40-
src/tests/TestUnitTest++.cpp \
41-
src/tests/TestTest.cpp \
42-
src/tests/TestTestResults.cpp \
43-
src/tests/TestTestRunner.cpp \
44-
src/tests/TestCheckMacros.cpp \
45-
src/tests/TestTestList.cpp \
46-
src/tests/TestTestMacros.cpp \
47-
src/tests/TestTimeConstraint.cpp \
48-
src/tests/TestTimeConstraintMacro.cpp \
49-
src/tests/TestMemoryOutStream.cpp \
50-
src/tests/TestDeferredTestReporter.cpp \
51-
src/tests/TestXmlTestReporter.cpp \
52-
src/tests/TestCurrentTest.cpp
53-
54-
objects = $(patsubst %.cpp, %.o, $(src))
55-
test_objects = $(patsubst %.cpp, %.o, $(test_src))
56-
dependencies = $(subst .o,.d,$(objects))
57-
test_dependencies = $(subst .o,.d,$(test_objects))
58-
59-
define make-depend
60-
$(CXX) $(CXXFLAGS) -M $1 | \
61-
$(SED) -e 's,\($(notdir $2)\) *:,$(dir $2)\1: ,' > $3.tmp
62-
$(SED) -e 's/#.*//' \
63-
-e 's/^[^:]*: *//' \
64-
-e 's/ *\\$$//' \
65-
-e '/^$$/ d' \
66-
-e 's/$$/ :/' $3.tmp >> $3.tmp
67-
$(MV) $3.tmp $3
68-
endef
69-
70-
71-
all: $(test)
72-
73-
74-
$(lib): $(objects)
75-
@echo Creating $(lib) library...
76-
@ar cr $(lib) $(objects)
77-
78-
$(test): $(lib) $(test_objects)
79-
@echo Linking $(test)...
80-
@$(CXX) $(LDFLAGS) -o $(test) $(test_objects) $(lib)
81-
@echo Running unit tests...
82-
@./$(test)
83-
84-
clean:
85-
-@$(RM) $(objects) $(test_objects) $(dependencies) $(test_dependencies) $(test) $(lib) 2> /dev/null
86-
87-
%.o : %.cpp
88-
@echo $<
89-
@$(call make-depend,$<,$@,$(subst .o,.d,$@))
90-
@$(CXX) $(CXXFLAGS) -c $< -o $(patsubst %.cpp, %.o, $<)
91-
92-
93-
ifneq "$(MAKECMDGOALS)" "clean"
94-
-include $(dependencies)
95-
-include $(test_dependencies)
96-
endif
1+
CXX = g++
2+
CXXFLAGS ?= -g -Wall -W -Winline -ansi
3+
LDFLAGS ?=
4+
SED = sed
5+
MV = mv
6+
RM = rm
7+
8+
.SUFFIXES: .o .cpp
9+
10+
lib = libUnitTest++.a
11+
test = TestUnitTest++
12+
13+
src = src/AssertException.cpp \
14+
src/Test.cpp \
15+
src/Checks.cpp \
16+
src/TestRunner.cpp \
17+
src/TestResults.cpp \
18+
src/TestReporter.cpp \
19+
src/TestReporterStdout.cpp \
20+
src/ReportAssert.cpp \
21+
src/TestList.cpp \
22+
src/TimeConstraint.cpp \
23+
src/TestDetails.cpp \
24+
src/MemoryOutStream.cpp \
25+
src/DeferredTestReporter.cpp \
26+
src/DeferredTestResult.cpp \
27+
src/XmlTestReporter.cpp \
28+
src/CurrentTest.cpp
29+
30+
ifeq ($(MSYSTEM), MINGW32)
31+
src += src/Win32/TimeHelpers.cpp
32+
else
33+
src += src/Posix/SignalTranslator.cpp \
34+
src/Posix/TimeHelpers.cpp
35+
endif
36+
37+
test_src = src/tests/Main.cpp \
38+
src/tests/TestAssertHandler.cpp \
39+
src/tests/TestChecks.cpp \
40+
src/tests/TestUnitTest++.cpp \
41+
src/tests/TestTest.cpp \
42+
src/tests/TestTestResults.cpp \
43+
src/tests/TestTestRunner.cpp \
44+
src/tests/TestCheckMacros.cpp \
45+
src/tests/TestTestList.cpp \
46+
src/tests/TestTestMacros.cpp \
47+
src/tests/TestTimeConstraint.cpp \
48+
src/tests/TestTimeConstraintMacro.cpp \
49+
src/tests/TestMemoryOutStream.cpp \
50+
src/tests/TestDeferredTestReporter.cpp \
51+
src/tests/TestXmlTestReporter.cpp \
52+
src/tests/TestCurrentTest.cpp
53+
54+
objects = $(patsubst %.cpp, %.o, $(src))
55+
test_objects = $(patsubst %.cpp, %.o, $(test_src))
56+
dependencies = $(subst .o,.d,$(objects))
57+
test_dependencies = $(subst .o,.d,$(test_objects))
58+
59+
define make-depend
60+
$(CXX) $(CXXFLAGS) -M $1 | \
61+
$(SED) -e 's,\($(notdir $2)\) *:,$(dir $2)\1: ,' > $3.tmp
62+
$(SED) -e 's/#.*//' \
63+
-e 's/^[^:]*: *//' \
64+
-e 's/ *\\$$//' \
65+
-e '/^$$/ d' \
66+
-e 's/$$/ :/' $3.tmp >> $3.tmp
67+
$(MV) $3.tmp $3
68+
endef
69+
70+
71+
all: $(test)
72+
73+
74+
$(lib): $(objects)
75+
@echo Creating $(lib) library...
76+
@ar cr $(lib) $(objects)
77+
78+
$(test): $(lib) $(test_objects)
79+
@echo Linking $(test)...
80+
@$(CXX) $(LDFLAGS) -o $(test) $(test_objects) $(lib)
81+
@echo Running unit tests...
82+
@./$(test)
83+
84+
clean:
85+
-@$(RM) $(objects) $(test_objects) $(dependencies) $(test_dependencies) $(test) $(lib) 2> /dev/null
86+
87+
%.o : %.cpp
88+
@echo $<
89+
@$(call make-depend,$<,$@,$(subst .o,.d,$@))
90+
@$(CXX) $(CXXFLAGS) -c $< -o $(patsubst %.cpp, %.o, $<)
91+
92+
93+
ifneq "$(MAKECMDGOALS)" "clean"
94+
-include $(dependencies)
95+
-include $(test_dependencies)
96+
endif

src/DeferredTestResult.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
#include "DeferredTestResult.h"
2-
#include "Config.h"
3-
4-
namespace UnitTest
5-
{
6-
7-
DeferredTestResult::DeferredTestResult()
8-
: suiteName("")
9-
, testName("")
10-
, failureFile("")
11-
, timeElapsed(0.0f)
12-
, failed(false)
13-
{
14-
}
15-
16-
DeferredTestResult::DeferredTestResult(char const* suite, char const* test)
17-
: suiteName(suite)
18-
, testName(test)
19-
, failureFile("")
20-
, timeElapsed(0.0f)
21-
, failed(false)
22-
{
23-
}
24-
25-
}
1+
#include "DeferredTestResult.h"
2+
#include "Config.h"
3+
4+
namespace UnitTest
5+
{
6+
7+
DeferredTestResult::DeferredTestResult()
8+
: suiteName("")
9+
, testName("")
10+
, failureFile("")
11+
, timeElapsed(0.0f)
12+
, failed(false)
13+
{
14+
}
15+
16+
DeferredTestResult::DeferredTestResult(char const* suite, char const* test)
17+
: suiteName(suite)
18+
, testName(test)
19+
, failureFile("")
20+
, timeElapsed(0.0f)
21+
, failed(false)
22+
{
23+
}
24+
25+
}

src/DeferredTestResult.h

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
#ifndef UNITTEST_DEFERREDTESTRESULT_H
2-
#define UNITTEST_DEFERREDTESTRESULT_H
3-
4-
#include <string>
5-
#include <vector>
6-
7-
namespace UnitTest
8-
{
9-
10-
struct DeferredTestResult
11-
{
12-
DeferredTestResult();
13-
DeferredTestResult(char const* suite, char const* test);
14-
15-
std::string suiteName;
16-
std::string testName;
17-
std::string failureFile;
18-
19-
typedef std::pair< int, std::string > Failure;
20-
typedef std::vector< Failure > FailureVec;
21-
FailureVec failures;
22-
23-
float timeElapsed;
24-
bool failed;
25-
};
26-
27-
}
28-
29-
#endif //UNITTEST_DEFERREDTESTRESULT_H
1+
#ifndef UNITTEST_DEFERREDTESTRESULT_H
2+
#define UNITTEST_DEFERREDTESTRESULT_H
3+
4+
#include <string>
5+
#include <vector>
6+
7+
namespace UnitTest
8+
{
9+
10+
struct DeferredTestResult
11+
{
12+
DeferredTestResult();
13+
DeferredTestResult(char const* suite, char const* test);
14+
~DeferredTestResult();
15+
16+
std::string suiteName;
17+
std::string testName;
18+
std::string failureFile;
19+
20+
typedef std::pair< int, std::string > Failure;
21+
typedef std::vector< Failure > FailureVec;
22+
FailureVec failures;
23+
24+
float timeElapsed;
25+
bool failed;
26+
};
27+
28+
}
29+
30+
#endif //UNITTEST_DEFERREDTESTRESULT_H

0 commit comments

Comments
 (0)