File: test-struct-size.c

package info (click to toggle)
libchewing 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,220 kB
  • ctags: 10,179
  • sloc: ansic: 103,539; sh: 11,563; makefile: 316; python: 98
file content (52 lines) | stat: -rw-r--r-- 1,228 bytes parent folder | download
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
52
/**
 * test-struct-size.c
 *
 * Copyright (c) 2014
 *  libchewing Core Team. See ChangeLog for details.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */
#include "testhelper.h"

typedef struct OrigianlChewingConfigData {
    int candPerPage;
    int maxChiSymbolLen;
    int selKey[MAX_SELKEY];
    int bAddPhraseForward;
    int bSpaceAsSelection;
    int bEscCleanAllBuf;
    int bAutoShiftCur;
    int bEasySymbolInput;
    int bPhraseChoiceRearward;
    int hsuSelKeyType;
} OrigianlChewingConfigData;

typedef struct OrigianlIntervalType {
    int from;
    int to;
} OrigianlIntervalType;

void test_ChewingConfigData()
{
    size_t expect = sizeof(OrigianlChewingConfigData);
    size_t actual = sizeof(ChewingConfigData);
    ok(actual == expect,
        "sizeof(ChewingConfigData) = %d shall be %d for ABI compatibility", actual, expect);
}

void test_IntervalType()
{
    size_t expect = sizeof(OrigianlIntervalType);
    size_t actual = sizeof(IntervalType);
    ok(actual == expect,
        "sizeof(IntervalType) = %d shall be %d for ABI compatibility", actual, expect);
}

int main()
{
    test_ChewingConfigData();
    test_IntervalType();

    return exit_status();
}