Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "parse-pinyin.hpp"
#include <iostream>
#include <glib.h>
static void
test_parse_pinyin ()
{
std::vector<Pinyin*>* result = parse_pinyin ("liyifeng");
g_assert_cmpint (result->size (), ==, 3);
g_assert_cmpint (result->at(0)->shengmu_i, ==, 10);
g_assert_cmpint (result->at(0)->yunmu_i, ==, 34);
g_assert_cmpint (result->at(0)->length, ==, 2);
g_assert_cmpint (result->at(1)->shengmu_i, ==, 21);
g_assert_cmpint (result->at(1)->yunmu_i, ==, 34);
g_assert_cmpint (result->at(1)->length, ==, 2);
g_assert_cmpint (result->at(2)->shengmu_i, ==, 5);
g_assert_cmpint (result->at(2)->yunmu_i, ==, 32);
g_assert_cmpint (result->at(2)->length, ==, 4);
for (guint i = 0; i < result->size (); ++i) {
delete result->at(i);
}
delete result;
}
int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/zero/test_parse_pinyin",
test_parse_pinyin);
return g_test_run ();
}