1 #include <simgear/compiler.h>
3 #include "parse_color.hxx"
7 #define COMPARE(a, b) \
10 std::cerr << "failed:" << #a << " != " << #b << std::endl; \
17 std::cerr << "failed:" << #a << std::endl; \
21 #define VERIFY_COLOR(str, r, g, b, a) \
22 VERIFY(simgear::parseColor(str, color)) \
23 COMPARE(color, osg::Vec4(r, g, b, a))
25 int main (int ac, char ** av)
28 VERIFY_COLOR("#ff0000", 1,0,0,1);
29 VERIFY_COLOR("#00ff00", 0,1,0,1);
30 VERIFY_COLOR("#0000ff", 0,0,1,1);
31 VERIFY_COLOR("rgb( 255,\t127.5,0)", 1, 0.5, 0, 1);
32 VERIFY_COLOR("rgba(255, 127.5,0, 0.5)", 1, 0.5, 0, 0.5);
33 std::cout << "all tests passed successfully!" << std::endl;