Skip to content

Commit

Permalink
update r641
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Jul 6, 2014
1 parent a5ebbcf commit 75912cc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
13 changes: 10 additions & 3 deletions test/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ifdef OUTPUTXML
$(RM) *.xml
endif
ifdef COVERAGE
$(RM) *.xml *.gcov *.gcno *.gcda
$(RM) *.xml *.gcov *.gcno *.gcda coverage.info
endif

check : test
Expand Down Expand Up @@ -185,8 +185,15 @@ endif
#
bench: benchmark
benchmark:
make -C benchmark clean
time make -C benchmark build;
-rm _time.log
num=1; while [[ $$num -le 5 ]]; do \
make -C benchmark clean; \
{ time -p make -C benchmark build 2>&1; } 2>> _time.log; \
((num = num + 1)); \
done
@awk 'BEGIN{ sum=0; max=0; min=-1; num=0; } \
{ if($$1=="user") { num+=1; if(min==-1){ min=$$2; } sum+=$$2; if($$2>max){max=$$2}; if(min>$$2){min=$$2}; } }\
END{ print("Total:", sum, "(",num,")" ); print("Min:", min); print("Max:", max); print("Avg:", sum/num); }' _time.log

#
#
Expand Down
29 changes: 28 additions & 1 deletion test/benchmark/benchmark_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
//-----------------------------------------------------------------------
//======================================================================


#include "iutest.hpp"

IUTEST_PACKAGE(PACKAGENAME)
Expand Down Expand Up @@ -50,4 +49,32 @@ IUTEST_PACKAGE(PACKAGENAME)
IUTEST_INSTANTIATE_TEST_CASE_P(B, ParamTest, ::iutest::Values(IUTEST_PP_ENUM_PARAMS(IUTEST_PP_LIMIT_ENUM, IUTEST_PP_EMPTY())));
IUTEST_INSTANTIATE_TEST_CASE_P(C, ParamTest, ::iutest::ValuesIn(make_param(1000, 0)));

template<typename T>
class TypedTest : public ::iutest::Test {};

typedef ::iutest::Types<char, signed char, unsigned char
, short, signed short, unsigned short
, int, signed int, unsigned int
, long, signed long, unsigned long
, float, double> TypedTestTypes;
IUTEST_TYPED_TEST_CASE(TypedTest, TypedTestTypes);

IUTEST_TYPED_TEST(TypedTest, Mul2)
{
TypeParam x = 1;
IUTEST_ASSERT_EQ(x+x, 2*x);
}

template<typename T>
class TypeParamTest : public ::iutest::Test {};
IUTEST_TYPED_TEST_CASE_P(TypeParamTest);

IUTEST_TYPED_TEST_P(TypeParamTest, Mul2)
{
TypeParam x = 1;
IUTEST_ASSERT_EQ(x+x, 2*x);
}

IUTEST_REGISTER_TYPED_TEST_CASE_P(TypeParamTest, Mul2);
IUTEST_INSTANTIATE_TYPED_TEST_CASE_P(A, TypeParamTest, TypedTestTypes);
}

0 comments on commit 75912cc

Please sign in to comment.