1 /**
2    Entry point for the contract tests
3  */
4 module contract.main;
5 
6 import python.raw: PyDateTime_CAPI;
7 
8 // To avoid linker errors.
9 export __gshared extern(C) PyDateTime_CAPI* PyDateTimeAPI;
10 
11 
12 extern(C) export auto PyInit_contract() {
13     static import contract.scalars;
14     static import contract.udt;
15     static import contract.pyclass;
16     import python.raw: pyDateTimeImport;
17     import python.cooked: createModule;
18     import python.boilerplate: Module, CFunctions, Aggregates;
19     import core.runtime: rt_init;
20 
21     rt_init;
22 
23     pyDateTimeImport;
24 
25     return createModule!(
26         Module("contract"),
27         CFunctions!(
28             contract.scalars.always_none,
29             contract.scalars.the_answer,
30             contract.scalars.one_bool_param_to_not,
31             contract.scalars.one_int_param_to_times_two,
32             contract.scalars.one_double_param_to_times_three,
33             contract.scalars.one_string_param_to_length,
34             contract.scalars.one_string_param_to_string,
35             contract.scalars.one_string_param_to_string_manual_mem,
36             contract.scalars.one_list_param,
37             contract.scalars.one_tuple_param,
38             contract.scalars.one_range_param,
39             contract.scalars.one_list_param_to_list,
40             contract.scalars.one_dict_param,
41             contract.scalars.one_dict_param_to_dict,
42             contract.scalars.add_days_to_date,
43             contract.scalars.add_days_to_datetime,
44             contract.scalars.throws_runtime_error,
45             contract.scalars.kwargs_count,
46 
47             contract.udt.simple_struct_func,
48             contract.udt.twice_struct_func,
49             contract.udt.struct_getset,
50 
51             contract.pyclass.pyclass_int_double_struct,
52             contract.pyclass.pyclass_string_list_struct,
53             contract.pyclass.pyclass_twice_struct,
54             contract.pyclass.pyclass_thrice_struct,
55             contract.pyclass.pyclass_void_struct,
56         ),
57         Aggregates!(
58             contract.udt.StructDefaultCtor,
59             contract.udt.StructUserCtor,
60         ),
61     );
62 }