| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkScript.h" | 10 #include "SkScript.h" |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 #ifdef SK_SUPPORT_UNITTEST | 1645 #ifdef SK_SUPPORT_UNITTEST |
| 1646 | 1646 |
| 1647 #include "SkFloatingPoint.h" | 1647 #include "SkFloatingPoint.h" |
| 1648 | 1648 |
| 1649 #define DEF_SCALAR_ANSWER 0 | 1649 #define DEF_SCALAR_ANSWER 0 |
| 1650 #define DEF_STRING_ANSWER NULL | 1650 #define DEF_STRING_ANSWER NULL |
| 1651 | 1651 |
| 1652 #define testInt(expression) { #expression, SkType_Int, expression, DEF_SCALAR_AN
SWER, DEF_STRING_ANSWER } | 1652 #define testInt(expression) { #expression, SkType_Int, expression, DEF_SCALAR_AN
SWER, DEF_STRING_ANSWER } |
| 1653 #ifdef SK_SCALAR_IS_FLOAT | |
| 1654 #define testScalar(expression) { #expression, SkType_Float, 0, (float) expre
ssion, DEF_STRING_ANSWER } | 1653 #define testScalar(expression) { #expression, SkType_Float, 0, (float) expre
ssion, DEF_STRING_ANSWER } |
| 1655 #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkType_Float, 0, sk_flo
at_mod(exp1, exp2), DEF_STRING_ANSWER } | 1654 #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkType_Float, 0, sk_flo
at_mod(exp1, exp2), DEF_STRING_ANSWER } |
| 1656 #else | |
| 1657 #define testScalar(expression) { #expression, SkType_Float, 0, (int) ((expre
ssion) * 65536.0f), DEF_STRING_ANSWER } | |
| 1658 #define testRemainder(exp1, exp2) { #exp1 "%" #exp2, SkType_Float, 0, (int)
(sk_float_mod(exp1, exp2) * 65536.0f), DEF_STRING_ANSWER } | |
| 1659 #endif | |
| 1660 #define testTrue(expression) { #expression, SkType_Int, 1, DEF_SCALAR_ANSWER, DE
F_STRING_ANSWER } | 1655 #define testTrue(expression) { #expression, SkType_Int, 1, DEF_SCALAR_ANSWER, DE
F_STRING_ANSWER } |
| 1661 #define testFalse(expression) { #expression, SkType_Int, 0, DEF_SCALAR_ANSWER, D
EF_STRING_ANSWER } | 1656 #define testFalse(expression) { #expression, SkType_Int, 0, DEF_SCALAR_ANSWER, D
EF_STRING_ANSWER } |
| 1662 | 1657 |
| 1663 static const SkScriptNAnswer scriptTests[] = { | 1658 static const SkScriptNAnswer scriptTests[] = { |
| 1664 testInt(1>1/2), | 1659 testInt(1>1/2), |
| 1665 testInt((6+7)*8), | 1660 testInt((6+7)*8), |
| 1666 testInt(0&&1?2:3), | 1661 testInt(0&&1?2:3), |
| 1667 testInt(3*(4+5)), | 1662 testInt(3*(4+5)), |
| 1668 testScalar(1.0+2.0), | 1663 testScalar(1.0+2.0), |
| 1669 testScalar(1.0+5), | 1664 testScalar(1.0+5), |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 break; | 1881 break; |
| 1887 case SkType_String: | 1882 case SkType_String: |
| 1888 SkASSERT(strcmp(value.fOperand.fString->c_str(), scriptTests[ind
ex].fStringAnswer) == 0); | 1883 SkASSERT(strcmp(value.fOperand.fString->c_str(), scriptTests[ind
ex].fStringAnswer) == 0); |
| 1889 break; | 1884 break; |
| 1890 default: | 1885 default: |
| 1891 SkASSERT(0); | 1886 SkASSERT(0); |
| 1892 } | 1887 } |
| 1893 } | 1888 } |
| 1894 } | 1889 } |
| 1895 #endif | 1890 #endif |
| OLD | NEW |