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

// This test fills out triples, matrices, and arrays, in order to test
// optimizations wherein the runtime recognizes that all elements are
// filled in with constants and replaces it all with a constant array.
// This test is primarily to ensure that it doesn't botch it.

shader test (output color Cout = 0)
{
    color C;
    C[0] = 0;
    C[1] = 1;
    C[2] = 2;
    Cout = C;
    printf ("C = %g\n", C);

    matrix m;
    m[0][0] = 1.0;
    m[0][1] = 0.0;
    m[0][2] = 0.0;
    m[0][3] = 0.0;
    m[1][0] = 0.0;
    m[1][1] = 1.0;
    m[1][2] = 0.0;
    m[1][3] = 0.0;
    m[2][0] = 0.0;
    m[2][1] = 0.0;
    m[2][2] = 1.0;
    m[2][3] = 0.0;
    m[3][0] = 0.0;
    m[3][1] = 0.0;
    m[3][2] = 0.0;
    m[3][3] = 1.0;
    printf ("m = %g\n", m);

    int ia[4];
    ia[0] = 0;
    ia[1] = 1;
    ia[2] = 2;
    ia[3] = 42;
    printf ("ia[] = %d %d %d %d\n", ia[0], ia[1], ia[2], ia[3]);

    float fa[4];
    fa[0] = 0.0;
    fa[1] = 1; // note: int
    fa[2] = 2;
    fa[3] = 3.14;
    printf ("fa[] = %g %g %g %g\n", fa[0], fa[1], fa[2], fa[3]);

    point pa[2];
    pa[0] = point(1,2,3);
    pa[1] = point(3.14,42.0,-1.0);
    printf ("pa[] = [%g] [%g]\n", pa[0], pa[1]);

    string sa[3];
    sa[0] = "Hello";
    sa[1] = "world";
    sa[2] = "foo!";
    printf ("sa[] = %s %s %s\n", sa[0], sa[1], sa[2]);
}

