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

shader
test ()
{
    // Sanity tests
    int nonzero = 7;
    int zero = 0;
    if (nonzero)
        printf ("1-clause uniform if %d:  Should print this\n", nonzero);
    if (zero)
        printf ("1-clause uniform if %d:  Should NOT NOT NOT print this!\n", zero);


    if (nonzero)
        printf ("2-clause uniform if %d:  true - Should print this\n", nonzero);
    else 
        printf ("2-clause uniform if %d:  false - Should NOT NOT NOT print this!\n", nonzero);
    if (zero)
        printf ("2-clause uniform if %d:  true - Should NOT NOT NOT print this!\n", zero);
    else
        printf ("2-clause uniform if %d:  false - Should print this\n", zero);

    printf ("Test varying if:\n");
    if (u < v) {
        printf ("u less than v: %g < %g\n", u, v);
    } else {
        printf ("u greater or equal than v: %g >= %g\n", u, v);
    }

    float fnonzero = M_PI;
    float fzero = 0.0;
    if (fnonzero)
        printf ("if (float=%g):  Should print this\n", fnonzero);
    if (fzero)
        printf ("if (float=%g):  Should NOT NOT NOT print this!\n", fzero);

    color cnonzero = M_PI;
    color czero = 0.0;
    if (cnonzero)
        printf ("if (color=%g):  Should print this\n", cnonzero);
    if (czero)
        printf ("if (color=%g):  Should NOT NOT NOT print this!\n", czero);


    closure color ccnonzero = emission();
    closure color cczero = 0;
    if (ccnonzero)
        printf ("if (closure color=%s):  Should print this\n", ccnonzero);
    if (cczero)
        printf ("if (closure color=%s):  Should NOT NOT NOT print this!\n", cczero);
    if (! cczero)
        printf ("if (! closure color=%s):  Should print this\n", cczero);
    if (!ccnonzero)
        printf ("if (! closure color=%s):  Should NOT NOT NOT print this!\n", ccnonzero);

    printf ("\n");
}
