Skip to content

Commit

Permalink
fix memory leakage in test
Browse files Browse the repository at this point in the history
  • Loading branch information
jingkaimori committed Nov 1, 2023
1 parent 69f06c9 commit b293f11
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/System/Classes/tm_timer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ test_same (tm_ostream& a, string b) {

string
to_zero (tm_ostream& out) {
string s1 = out.unbuffer ();
char* ans = as_charp (s1);
char* current= ans;
string s1= out.unbuffer ();
c_string ans (s1);
char* current= ans;
while ((current= strstr (current, "took"))) {
current+= strlen ("took");
while (*current && (*current == '(')) {
Expand Down Expand Up @@ -196,14 +196,6 @@ TEST_CASE ("function bench_reset") {
}
}

TEST_CASE ("clean up before testing memory leak") {
bench_reset ("task");
bench_reset ("task1");
bench_reset ("task2");
}

TEST_MEMORY_LEAK_ALL

TEST_CASE ("function bench_print") {
tm_ostream ostream;
ostream.buffer ();
Expand Down Expand Up @@ -244,3 +236,10 @@ TEST_CASE ("function bench_print") {
CHECK (out == b);
}
}

TEST_CASE ("testing memory leakage of tm_timer") {
bench_reset ("task");
bench_reset ("task1");
bench_reset ("task2");
CHECK_EQ (mem_used (), mem_lolly);
}

0 comments on commit b293f11

Please sign in to comment.