630861350a8b847fada137b7337879007d6c5ab2
[platform/upstream/flatbuffers.git] / tests / BUILD
1 load("@rules_cc//cc:defs.bzl", "cc_test")
2
3 package(default_visibility = ["//visibility:private"])
4
5 # Test binary.
6 cc_test(
7     name = "flatbuffers_test",
8     testonly = 1,
9     srcs = [
10         "evolution_test/evolution_v1_generated.h",
11         "evolution_test/evolution_v2_generated.h",
12         "namespace_test/namespace_test1_generated.h",
13         "namespace_test/namespace_test2_generated.h",
14         "native_type_test_impl.cpp",
15         "native_type_test_impl.h",
16         "test.cpp",
17         "test_assert.cpp",
18         "test_assert.h",
19         "test_builder.cpp",
20         "test_builder.h",
21         "union_vector/union_vector_generated.h",
22     ],
23     copts = [
24         "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
25         "-DBAZEL_TEST_DATA_PATH",
26     ],
27     data = [
28         ":arrays_test.bfbs",
29         ":arrays_test.fbs",
30         ":arrays_test.golden",
31         ":evolution_test/evolution_v1.fbs",
32         ":evolution_test/evolution_v1.json",
33         ":evolution_test/evolution_v2.fbs",
34         ":evolution_test/evolution_v2.json",
35         ":include_test/include_test1.fbs",
36         ":include_test/sub/include_test2.fbs",
37         ":monster_extra.fbs",
38         ":monster_test.bfbs",
39         ":monster_test.fbs",
40         ":monsterdata_extra.json",
41         ":monsterdata_test.golden",
42         ":monsterdata_test.json",
43         ":native_type_test.fbs",
44         ":prototest/imported.proto",
45         ":prototest/test.golden",
46         ":prototest/test.proto",
47         ":prototest/test_include.golden",
48         ":prototest/test_union.golden",
49         ":prototest/test_union_include.golden",
50         ":unicode_test.json",
51         ":union_vector/union_vector.fbs",
52         ":union_vector/union_vector.json",
53     ],
54     includes = [
55         "",
56         "include/",
57     ],
58     deps = [
59         ":arrays_test_cc_fbs",
60         ":monster_extra_cc_fbs",
61         ":monster_test_cc_fbs",
62         ":native_type_test_cc_fbs",
63         "//:flatbuffers",
64     ],
65 )
66
67 # Test bzl rules
68 load("//:build_defs.bzl", "flatbuffer_cc_library")
69
70 flatbuffer_cc_library(
71     name = "monster_test_cc_fbs",
72     srcs = ["monster_test.fbs"],
73     include_paths = ["tests/include_test"],
74     includes = [
75         "include_test/include_test1.fbs",
76         "include_test/sub/include_test2.fbs",
77     ],
78 )
79
80 flatbuffer_cc_library(
81     name = "monster_extra_cc_fbs",
82     srcs = ["monster_extra.fbs"],
83 )
84
85 flatbuffer_cc_library(
86     name = "arrays_test_cc_fbs",
87     srcs = ["arrays_test.fbs"],
88     flatc_args = [
89         "--gen-object-api",
90         "--gen-compare",
91         "--no-includes",
92         "--gen-mutable",
93         "--reflect-names",
94         "--cpp-ptr-type flatbuffers::unique_ptr",
95         "--scoped-enums",
96     ],
97 )
98
99 flatbuffer_cc_library(
100     name = "native_type_test_cc_fbs",
101     srcs = ["native_type_test.fbs"],
102     flatc_args = [
103         "--gen-object-api",
104         "--gen-mutable",
105         "--cpp-ptr-type flatbuffers::unique_ptr",
106     ],
107 )