|
|
@ -20,11 +20,205 @@ struct logging_test : public test_scaffold { |
|
|
|
|
|
|
|
const gp::buffer<char> name{"FIRST TEST"}; |
|
|
|
const gp::buffer<char> text{"FIRST TEST TEXT"}; |
|
|
|
const gp::buffer<char> new_text{"NEW TEST TEXT"}; |
|
|
|
|
|
|
|
static_logging_segment<4> logger; |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 0, "new logger not empty"); |
|
|
|
|
|
|
|
logger.push_segment(name, text); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 1, "should be 1 after insertion"); |
|
|
|
|
|
|
|
logger.set_segment(name, new_text); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 1, "should still be one as key is identical"); |
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_rduhk786f(new logging_test{}); |
|
|
|
|
|
|
|
|
|
|
|
struct logging_test2 : public test_scaffold { |
|
|
|
logging_test2() { |
|
|
|
name = __FILE__ ":2"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
int res = 0; |
|
|
|
|
|
|
|
const gp::buffer<char> name[5]{{"TEST 1"},{"TEST 2"},{"TEST 3"},{"TEST 4"},{"TEST 5"}}; |
|
|
|
const gp::buffer<char> texts[5] {{"NEW TEST TEXT 1"},{"NEW TEST TEXT 2"},{"NEW TEST TEXT 3"},{"NEW TEST TEXT 4"},{"NEW TEST TEXT 5"}}; |
|
|
|
|
|
|
|
static_logging_segment<4> logger; |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 0, "new logger not empty"); |
|
|
|
|
|
|
|
for(auto i : {0,1,2,3,4}) { |
|
|
|
logger.push_segment(name[i], texts[i]); |
|
|
|
} |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() <= 4, "Size should be capped at 4"); |
|
|
|
gp_config::assertion(logger.size() == 4, "Size should be 4"); |
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_sghgfg6f(new logging_test2{}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct logging_test3 : public test_scaffold { |
|
|
|
logging_test3() { |
|
|
|
name = __FILE__ ":3"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
int res = 0; |
|
|
|
|
|
|
|
const gp::buffer<char> name[5]{{"TEST 1"},{"TEST 2"},{"TEST 3"},{"TEST 4"},{"TEST 5"}}; |
|
|
|
const gp::buffer<char> texts[5] {{"NEW TEST TEXT 1"},{"NEW TEST TEXT 2"},{"NEW TEST TEXT 3"},{"NEW TEST TEXT 4"},{"NEW TEST TEXT 5"}}; |
|
|
|
|
|
|
|
static_logging_segment<4> logger; |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 0, "new logger not empty"); |
|
|
|
|
|
|
|
for(auto i : {0,1,2,3,4}) { |
|
|
|
logger.set_segment(name[i], texts[i]); |
|
|
|
log_segment("new element", name[i].begin().data); |
|
|
|
} |
|
|
|
|
|
|
|
log_segment("size", std::to_string(logger.size()).c_str()); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() <= 4, "Size should be capped at 4"); |
|
|
|
gp_config::assertion(logger.size() == 4, "Size should be 4"); |
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_dgiudfg6f(new logging_test3{}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct logging_test4 : public test_scaffold { |
|
|
|
logging_test4() { |
|
|
|
name = __FILE__ ":4"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
int res = 0; |
|
|
|
|
|
|
|
const gp::buffer<char> name[5]{{"TEST 1"},{"TEST 2"},{"TEST 3"},{"TEST 4"},{"TEST 5"}}; |
|
|
|
const gp::buffer<char> texts[5] {{"NEW TEST TEXT 1"},{"NEW TEST TEXT 2"},{"NEW TEST TEXT 3"},{"NEW TEST TEXT 4"},{"NEW TEST TEXT 5"}}; |
|
|
|
|
|
|
|
static_logging_segment<4> logger; |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 0, "new logger not empty"); |
|
|
|
|
|
|
|
for(auto i : {0,1,2,3,4}) { |
|
|
|
logger.set_segment(name[i], texts[i]); |
|
|
|
} |
|
|
|
|
|
|
|
log_segment("size", std::to_string(logger.size()).c_str()); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() <= 4, "Size should be capped at 4"); |
|
|
|
gp_config::assertion(logger.size() == 4, "Size should be 4"); |
|
|
|
|
|
|
|
for(auto i : {0, 1, 2, 3}) { |
|
|
|
auto v = logger.get_segment_by_idx(i); |
|
|
|
bool same = true; |
|
|
|
for(size_t it = 0; it < 4; it++) { |
|
|
|
same &= name[0][it] == v.name[it]; |
|
|
|
} |
|
|
|
gp_config::assertion(!same, "Should not contain oldest element"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_aertm46f(new logging_test4{}); |
|
|
|
|
|
|
|
struct logging_test5 : public test_scaffold { |
|
|
|
logging_test5() { |
|
|
|
name = __FILE__ ":5"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
int res = 0; |
|
|
|
|
|
|
|
const gp::buffer<char> name[5]{{"TEST 1"},{"TEST 2"},{"TEST 3"},{"TEST 4"},{"TEST 5"}}; |
|
|
|
const gp::buffer<char> texts[5] {{"NEW TEST TEXT 1"},{"NEW TEST TEXT 2"},{"NEW TEST TEXT 3"},{"NEW TEST TEXT 4"},{"NEW TEST TEXT 5"}}; |
|
|
|
const uint16_t prios[5] {1,1,0,1,1}; |
|
|
|
|
|
|
|
static_logging_segment<4> logger; |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 0, "new logger not empty"); |
|
|
|
|
|
|
|
for(auto i : {0,1,2,3,4}) { |
|
|
|
logger.set_segment(name[i], texts[i], prios[i]); |
|
|
|
} |
|
|
|
|
|
|
|
log_segment("size", std::to_string(logger.size()).c_str()); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() <= 4, "Size should be capped at 4"); |
|
|
|
gp_config::assertion(logger.size() == 4, "Size should be 4"); |
|
|
|
|
|
|
|
for(auto i : {0, 1, 2, 3}) { |
|
|
|
auto v = logger.get_segment_by_idx(i); |
|
|
|
log_segment("prio value", std::to_string(v.priority).c_str()); |
|
|
|
gp_config::assertion(v.priority != 0, "Should not contain low prio element"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_azefdhi6f(new logging_test5{}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct logging_test6 : public test_scaffold { |
|
|
|
logging_test6() { |
|
|
|
name = __FILE__ ":6"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
int res = 0; |
|
|
|
|
|
|
|
const gp::buffer<char> name{"FIRST TEST"}; |
|
|
|
const gp::buffer<char> text{"FIRST TEST TEXT"}; |
|
|
|
const gp::buffer<char> new_text{"NEW TEST TEXT"}; |
|
|
|
|
|
|
|
static_logging_segment<4> logger; |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 0, "new logger not empty"); |
|
|
|
|
|
|
|
logger.push_segment(name, text); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 1, "should be 1 after insertion"); |
|
|
|
|
|
|
|
logger.set_segment(name, new_text); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 1, "should still be one as key is identical"); |
|
|
|
|
|
|
|
logger.clear(); |
|
|
|
|
|
|
|
gp_config::assertion(logger.size() == 0, "should be zero after clear"); |
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_ra45645sdf(new logging_test6{}); |