// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

closure color
parameter_test(int int_param, float float_param, color color_param,
               vector vector_param, string string_param, int int_array[5],
               vector vector_array[5], color color_array[5],
               float float_array[5], string string_array[5])[[int builtin = 1]];

shader
test()
{
    // Test all parameter types with uniform values
    int a[5]    = { 6, 7, 8, 101, 102 };
    vector b[5] = { vector(9, 10, 11), vector(12, 13, 14), vector(15, 16, 17),
                    vector(103, 104, 105), vector(106, 107, 108) };
    color c[5]  = { color(18, 19, 20), color(21, 22, 23), color(24, 25, 26),
                   color(109, 110, 111), color(112, 113, 114) };
    float d[5]  = { 27, 28, 29, 115, 116 };
    string e[5] = { "a", "b", "testString", "more", "words" };

    Ci = parameter_test(30, 31.0, color(32, 33, 34), vector(35, 36, 37),
                        "testString", a, b, c, d, e, "int_key", 38, "float_key",
                        39.0, "color_key", color(40, 41, 42), "vector_key",
                        vector(43, 44, 45), "string_key", "keywordTestString");
    printf("  Ci = %s\n", Ci);

    // Test all parameter types with varying values
    int a2[5]    = { int(u * 10), int(v * 10), 7, 117, int((u + v) * 10) };
    vector b2[5] = { vector(0.1), vector(0.2, u, v), vector(42.0),
                     vector(118, 119, 120), vector(v, u, 121) };
    color c2[5]  = { color(u), color(u, v, 0.3), color(v), color(122, 123, 124),
                    color(u + v) };
    float d2[5]  = { u, v, 0.7, 0.8, v + u };
    string e2[5] = { "a", "b", format("%f", u), "more", format("%f", v) };

    Ci = parameter_test(int(u * 10), u, color(u, v, 0.3), vector(0.2, u, v),
                        format("%f", u), a2, b2, c2, d2, e2, "int_key",
                        int(u * 10), "float_key", u, "color_key",
                        color(u, v, 0.3), "vector_key", vector(0.2, u, v),
                        "string_key", format("%f", u));
    printf("  Ci = %s\n", Ci);
}
