Blender V5.3
metadata_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
6
7namespace blender::gpu::tests {
8
9using namespace shader::parser;
10using namespace shader;
11using namespace std;
12
13TEST(shader_tool, Include)
14{
15 {
16 string input = R"(
17#include "a.hh"
18#include "b.glsl"
19#if 0
20# include "c.hh"
21#else
22# include "d.hh"
23#endif
24#if !defined(GPU_SHADER)
25# include "e.hh"
26#endif
27)";
28 string expect =
29 R"(static void test(GPUSource &source, GPUFunctionDictionary *g_functions, GPUPrintFormatMap *g_formats) {
30 source.add_dependency("a.hh");
31 source.add_dependency("b.glsl");
32 source.add_dependency("d.hh");
33 UNUSED_VARS(source, g_functions, g_formats);
34}
35)";
36 auto [output, metadata, error] = process_test_string(input);
37 EXPECT_EQ(expect, metadata.serialize("test"));
38 EXPECT_EQ(error, "");
39 }
40}
41
42} // namespace blender::gpu::tests
#define output
TEST(shader_tool, ExpressionParser)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)