diff options
| author | chenzizhan <[email protected]> | 2023-12-18 10:36:10 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2023-12-18 10:36:10 +0800 |
| commit | c19b0d08be3ce70641c1c5707d3e67fa3c50c72e (patch) | |
| tree | 79be6982308e69ccd35b905536dc0fe79edc47d9 /test/test_easy_fs.cpp | |
| parent | a3bd4934eb46e67d76489e2fec597e9cb30a84de (diff) | |
feat: fieldstat easy resetv4.4.4
Diffstat (limited to 'test/test_easy_fs.cpp')
| -rw-r--r-- | test/test_easy_fs.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_easy_fs.cpp b/test/test_easy_fs.cpp index 54e22f6..d6f9177 100644 --- a/test/test_easy_fs.cpp +++ b/test/test_easy_fs.cpp @@ -199,6 +199,23 @@ TEST(test_easy_fieldstat, ensure_data_racing_of_two_output_and_of_incyby) remove(FILENAME); } +TEST(test_easy_fieldstat, reset) +{ + struct fieldstat_easy *fse = fieldstat_easy_new(3, NULL, NULL, 0); + int counter_id = fieldstat_easy_register_counter(fse, "metric counter"); + fieldstat_easy_counter_incrby(fse, 0, counter_id, &TEST_TAG_INT, 1, 1); + fieldstat_easy_counter_incrby(fse, 1, counter_id, &TEST_TAG_INT, 1, 1); + + fieldstat_easy_reset(fse); + char *buff = NULL; + size_t buff_len = 0; + fieldstat_easy_output(fse, &buff, &buff_len); + EXPECT_STREQ(buff, "[]"); + + free(buff); + fieldstat_easy_free(fse); +} + int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); |
