File: test-struct-size.c

package info (click to toggle)
libchewing 0.10.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,040 kB
  • sloc: ansic: 7,031; python: 190; sh: 127; makefile: 44
file content (52 lines) | stat: -rw-r--r-- 1,205 bytes parent folder | download | duplicates (2)
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 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();
}