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

shader
test ()
{
    // float
    {
        printf ("float:\n");
        float a = 0.7;
        float b = 0.2;
        float z = 0;
        printf ("  %g + %g = %g\n", a, b, a+b);
        printf ("  %g - %g = %g\n", a, b, a-b);
        printf ("  %g * %g = %g\n", a, b, a*b);
        printf ("  %g / %g = %g\n", a, b, a/b);
        printf ("  %g / %g = %g\n", a, z, a/z);
        printf ("  - %g = %g\n", a, -a);
        printf ("  %g / 0 = %g\n", a, a/0.0);
        printf ("\n");
    }

    // mixed float and int
    {
        printf ("float/int:\n");
        float a = 0.7;
        int b = 2;
        float z = 0;
        printf ("  %g + %d = %g\n", a, b, a+b);
        printf ("  %d + %g = %g\n", b, a, b+a);
        printf ("  %g - %d = %g\n", a, b, a-b);
        printf ("  %d - %g = %g\n", b, a, b-a);
        printf ("  %g * %d = %g\n", a, b, a*b);
        printf ("  %d * %g = %g\n", b, a, b*a);
        printf ("  %g / %d = %g\n", a, b, a/b);
        printf ("  %d / %g = %g\n", b, a, b/a);
        printf ("\n");
    }

    // triple
    {
        printf ("triple:\n");
        color a = 0.7;
        color b = 0.2;
        float f = 0.5;
        color z = 0;
        float zf = 0;
        printf ("  %g + %g = %g\n", a, b, a+b);
        printf ("  %g - %g = %g\n", a, b, a-b);
        printf ("  %g * %g = %g\n", a, b, a*b);
        printf ("  %g / %g = %g\n", a, b, a/b);
        printf ("  %g / %g = %g\n", a, z, a/z);
        printf ("  %g / %g = %g\n", a, zf, a/zf);
        printf ("  - %g = %g\n", a, -a);

        printf ("  %g + %g = %g\n", a, f, a+f);
        printf ("  %g - %g = %g\n", a, f, a-f);
        printf ("  %g * %g = %g\n", a, f, a*f);
        printf ("  %g / %g = %g\n", a, f, a/f);
        printf ("  %g + %g = %g\n", f, a, f+a);
        printf ("  %g - %g = %g\n", f, a, f-a);
        printf ("  %g * %g = %g\n", f, a, f*a);
        printf ("  %g / %g = %g\n", f, a, f/a);
        printf ("\n");
    }

    // int
    {
        printf ("int:\n");
        int a = 7;
        int b = 2;
        printf ("  %d + %d = %d\n", a, b, a+b);
        printf ("  %d - %d = %d\n", a, b, a-b);
        printf ("  %d * %d = %d\n", a, b, a*b);
        printf ("  %d / %d = %d\n", a, b, a/b);
        printf ("  %d %% %d = %d\n", a, b, a%b);
        printf ("  - %d = %d\n", a, -a);
        printf ("  %d / 0 = %d\n", a, a/0);
        printf ("\n");
    }

}
