Initial import to Tizen
[profile/ivi/sphinxbase.git] / test / unit / test_ngram / test_lm_recode.c
1 #include <ngram_model.h>
2 #include <logmath.h>
3 #include <strfuncs.h>
4
5 #include "test_macros.h"
6
7 #include <stdio.h>
8 #include <string.h>
9 #include <math.h>
10
11 int
12 main(int argc, char *argv[])
13 {
14         logmath_t *lmath;
15         ngram_model_t *model;
16
17         /* Initialize a logmath object to pass to ngram_read */
18         lmath = logmath_init(1.0001, 0, 0);
19
20         /* Read a language model */
21         model = ngram_model_read(NULL, LMDIR "/100.arpa.DMP", NGRAM_DMP, lmath);
22         TEST_ASSERT(model);
23
24         ngram_model_recode(model, "iso8859-1", "utf-8");
25         TEST_EQUAL(strcmp(ngram_word(model, 0), "<UNK>"), 0);
26         ngram_model_free(model);
27         logmath_free(lmath);
28
29         return 0;
30 }