X Tutup
Skip to content

Commit 61ce32f

Browse files
author
Sebastiano Merlino
committed
Moved littletest to new version
1 parent 754a092 commit 61ce32f

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

test/littletest.hpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#include <sys/time.h>
3131
#include <vector>
3232

33-
#define littletest_version 1_0
34-
3533
#define WARN 0
3634
#define CHECK 1
3735
#define ASSERT 2
@@ -329,9 +327,9 @@ class suite
329327
static_cast<suite_impl*>(this)->set_up();
330328
}
331329

332-
void suite_tier_down()
330+
void suite_tear_down()
333331
{
334-
static_cast<suite_impl*>(this)->tier_down();
332+
static_cast<suite_impl*>(this)->tear_down();
335333
}
336334

337335
suite() { }
@@ -360,7 +358,7 @@ struct test_runner
360358
last_checkpoint_line(-1),
361359
good_time_total(0.0),
362360
total_set_up_time(0.0),
363-
total_tier_down_time(0.0),
361+
total_tear_down_time(0.0),
364362
total_time(0.0)
365363
{
366364
}
@@ -394,7 +392,7 @@ struct test_runner
394392
std::cout << "Total run time: " << total_time << std::endl;
395393
std::cout << "Total time spent in tests: " << good_time_total << " ms" << std::endl;
396394
std::cout << "Average set up time: " << (total_set_up_time / test_counter) << " ms" << std::endl;
397-
std::cout << "Average tier down time: " << (total_tier_down_time / test_counter) << " ms" << std::endl;
395+
std::cout << "Average tear down time: " << (total_tear_down_time / test_counter) << " ms" << std::endl;
398396
}
399397

400398
void add_failure()
@@ -424,9 +422,9 @@ struct test_runner
424422
total_set_up_time += t;
425423
}
426424

427-
void add_tier_down_time(double t)
425+
void add_tear_down_time(double t)
428426
{
429-
total_tier_down_time += t;
427+
total_tear_down_time += t;
430428
}
431429

432430
void add_total_time(double t)
@@ -473,7 +471,7 @@ struct test_runner
473471
int failures_counter;
474472
double good_time_total;
475473
double total_set_up_time;
476-
double total_tier_down_time;
474+
double total_tear_down_time;
477475
double total_time;
478476
};
479477

@@ -492,7 +490,7 @@ class test : public test_base
492490
{
493491
virtual void run_test(test_runner* tr)
494492
{
495-
double set_up_duration = 0.0, tier_down_duration = 0.0, test_duration = 0.0;
493+
double set_up_duration = 0.0, tear_down_duration = 0.0, test_duration = 0.0;
496494
timeval before, after;
497495
try
498496
{
@@ -544,21 +542,21 @@ class test : public test_base
544542
try
545543
{
546544
gettimeofday(&before, NULL);
547-
static_cast<test_impl* >(this)->suite_tier_down();
545+
static_cast<test_impl* >(this)->suite_tear_down();
548546
gettimeofday(&after, NULL);
549-
tier_down_duration = calculate_duration(&before, &after);
550-
tr->add_tier_down_time(tier_down_duration);
547+
tear_down_duration = calculate_duration(&before, &after);
548+
tr->add_tear_down_time(tear_down_duration);
551549
}
552550
catch(std::exception& e)
553551
{
554-
std::cout << "Exception during " << static_cast<test_impl* >(this)->name << " tier down" << std::endl;
552+
std::cout << "Exception during " << static_cast<test_impl* >(this)->name << " tear down" << std::endl;
555553
std::cout << e.what() << std::endl;
556554
}
557555
catch(...)
558556
{
559-
std::cout << "Exception during " << static_cast<test_impl* >(this)->name << " tier down" << std::endl;
557+
std::cout << "Exception during " << static_cast<test_impl* >(this)->name << " tear down" << std::endl;
560558
}
561-
double total = set_up_duration + test_duration + tier_down_duration;
559+
double total = set_up_duration + test_duration + tear_down_duration;
562560
tr->add_total_time(total);
563561
}
564562
protected:

0 commit comments

Comments
 (0)
X Tutup