~ubuntu-branches/ubuntu/hardy/uim/hardy

« back to all changes in this revision

Viewing changes to sigscheme/test-c/test-global-coll.c

  • Committer: Bazaar Package Importer
  • Author(s): Masahito Omote
  • Date: 2007-04-21 03:46:09 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070421034609-gpcurkutp8vaysqj
Tags: 1:1.4.1-3
* Switch to dh_gtkmodules for the gtk 2.10 transition (Closes:
  #419318)
  - debian/control: Add ${misc:Depends} and remove libgtk2.0-bin on
    uim-gtk2.0.
  - debian/uim-gtk2.0.post{inst,rm}: Removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#line 1 "test-global.c"
 
2
/*===========================================================================
 
3
 *  Filename : test-global.c
 
4
 *  About    : unit test for global object handlings
 
5
 *
 
6
 *  Copyright (C) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
 
7
 *  Copyright (c) 2007 SigScheme Project <uim AT freedesktop.org>
 
8
 *
 
9
 *  All rights reserved.
 
10
 *
 
11
 *  Redistribution and use in source and binary forms, with or without
 
12
 *  modification, are permitted provided that the following conditions
 
13
 *  are met:
 
14
 *
 
15
 *  1. Redistributions of source code must retain the above copyright
 
16
 *     notice, this list of conditions and the following disclaimer.
 
17
 *  2. Redistributions in binary form must reproduce the above copyright
 
18
 *     notice, this list of conditions and the following disclaimer in the
 
19
 *     documentation and/or other materials provided with the distribution.
 
20
 *  3. Neither the name of authors nor the names of its contributors
 
21
 *     may be used to endorse or promote products derived from this software
 
22
 *     without specific prior written permission.
 
23
 *
 
24
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
 
25
 *  IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 
26
 *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
27
 *  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
 
28
 *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 
29
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
30
 *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 
31
 *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 
32
 *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 
33
 *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 
34
 *  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
35
===========================================================================*/
 
36
 
 
37
#define SCM_WRITABLE_STATICLESS_PLATFORM 0
 
38
#define SCM_COMBINED_SOURCE 0
 
39
 
 
40
#include "sscm-test.h"
 
41
 
 
42
#include <sigscheme/global.h>
 
43
#include <sigscheme/sigscheme.h>
 
44
#include "sigschemeinternal.h"
 
45
 
 
46
SCM_GLOBAL_VARS_BEGIN(exported);
 
47
ScmObj obj_a, obj_b;
 
48
ScmObj obj_c;
 
49
SCM_GLOBAL_VARS_END(exported);
 
50
#define obj_a SCM_GLOBAL_VAR(exported, obj_a)
 
51
#define obj_b SCM_GLOBAL_VAR(exported, obj_b)
 
52
#define obj_c SCM_GLOBAL_VAR(exported, obj_c)
 
53
SCM_DECLARE_EXPORTED_VARS(exported);
 
54
SCM_DEFINE_EXPORTED_VARS(exported);
 
55
 
 
56
SCM_GLOBAL_VARS_BEGIN(static);
 
57
ScmObj obj_d, obj_e;
 
58
ScmObj obj_f;
 
59
SCM_GLOBAL_VARS_END(static);
 
60
#define obj_d SCM_GLOBAL_VAR(static, obj_d)
 
61
#define obj_e SCM_GLOBAL_VAR(static, obj_e)
 
62
#define obj_f SCM_GLOBAL_VAR(static, obj_f)
 
63
SCM_DEFINE_STATIC_VARS(static);
 
64
 
 
65
TST_CASE(tst_1, "exported vars")
 
66
{
 
67
    SCM_GLOBAL_VARS_INIT(exported);
 
68
    obj_a = MAKE_INT(1);
 
69
    obj_b = MAKE_INT(2);
 
70
    obj_c = MAKE_INT(3);
 
71
    TST_TN_EQ_INT(1, SCM_INT_VALUE(obj_a));
 
72
    TST_TN_EQ_INT(2, SCM_INT_VALUE(obj_b));
 
73
    TST_TN_EQ_INT(3, SCM_INT_VALUE(obj_c));
 
74
}
 
75
 
 
76
TST_CASE(tst_2, "static vars")
 
77
{
 
78
    SCM_GLOBAL_VARS_INIT(static);
 
79
    obj_d = MAKE_INT(4);
 
80
    obj_e = MAKE_INT(5);
 
81
    obj_f = MAKE_INT(6);
 
82
    TST_TN_EQ_INT(4, SCM_INT_VALUE(obj_d));
 
83
    TST_TN_EQ_INT(5, SCM_INT_VALUE(obj_e));
 
84
    TST_TN_EQ_INT(6, SCM_INT_VALUE(obj_f));
 
85
}
 
86
TST_LIST_BEGIN()
 
87
    TST_REGISTER(tst_1)
 
88
    TST_REGISTER(tst_2)
 
89
TST_LIST_END()