File: decl_impl.c

package info (click to toggle)
interface99 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: ansic: 951; sh: 48; makefile: 6
file content (30 lines) | stat: -rw-r--r-- 507 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
#include <interface99.h>

#include "common.h"

#include <assert.h>

typedef struct {
    char dummy;
} BarImpl;

declImpl(Bar, BarImpl);

static void test_decl_impl(void) {
    assert(VTABLE(BarImpl, Bar).foo == foo1_impl);
    assert(VTABLE(BarImpl, Bar).bar == bar1_impl);
}

#define BarImpl_foo foo1_impl
#define BarImpl_bar bar1_impl
impl(Bar, BarImpl);

// Multiple declarations should work fine.
declImpl(Bar, BarImpl);
declImpl(Bar, BarImpl);

int main(void) {
    test_decl_impl();

    return 0;
}