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 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
/**
* test-key2pho.c
*
* Copyright (c) 2005
* libchewing Core Team. See ChangeLog for details.
*
* See the file "COPYING" for information on usage and redistribution
* of this file.
*/
#include <stdio.h>
#include <string.h>
#include <check.h>
#include "chewing-utf8-util.h"
START_TEST(test_UintFromPhone)
{
char *u8phone = "ㄆㄣ";
fail_if(UintFromPhone(u8phone) != 1104, NULL);
u8phone = "ㄊㄧㄢ";
fail_if(UintFromPhone(u8phone) != 3272, NULL);
u8phone = "ㄒㄧㄚˋ";
fail_if(UintFromPhone(u8phone) != 7308, NULL);
}
END_TEST
START_TEST(test_PhoneFromKey)
{
char rt[10];
PhoneFromKey( rt, "dj", 0, 1 );
fail_if( strcmp(rt, "ㄎㄨ"), NULL);
PhoneFromKey( rt, "dj6", 0, 1 );
fail_if( strcmp(rt, "ㄎㄨˊ"), NULL);
PhoneFromKey( rt, "dj3", 0, 1 );
fail_if( strcmp(rt, "ㄎㄨˇ"), NULL);
PhoneFromKey( rt, "dj4", 0, 1 );
fail_if( strcmp(rt, "ㄎㄨˋ"), NULL);
PhoneFromKey( rt, "dj7", 0, 1 );
fail_if( strcmp(rt, "ㄎㄨ˙"), NULL);
}
END_TEST
Suite *key2pho_suite (void)
{
Suite *s = suite_create("key2pho.c");
TCase *tc_core = tcase_create("Core");
suite_add_tcase (s, tc_core);
tcase_add_test (tc_core, test_UintFromPhone);
tcase_add_test (tc_core, test_PhoneFromKey);
return s;
}
|