2 * Copyright (C) 2010 Joel Rosdahl
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 3 of the License, or (at your option)
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * This file contains tests for statistics handling.
25 #include "test/framework.h"
26 #include "test/util.h"
30 TEST(forward_compatibility)
34 struct counters *counters = counters_init(0);
36 f = fopen("stats", "w");
37 for (i = 0; i < 100; i++) {
38 fprintf(f, "%u\n", i);
42 stats_read("stats", counters);
43 CHECK_UNS_EQ(100, counters->size);
44 CHECK_UNS_EQ(73, counters->data[73]);
46 stats_write("stats", counters);
47 CHECK_UNS_EQ(100, counters->size);
48 CHECK_UNS_EQ(99, counters->data[99]);
50 counters_free(counters);