|
6 | 6 | #include <string> |
7 | 7 |
|
8 | 8 | #include "base/assert.h" |
| 9 | +#include "base/vector.h" |
9 | 10 | #include "config/command_line.h" |
10 | 11 | #include "web/color_map.h" |
11 | 12 |
|
12 | 13 | int main(int argc, char* argv[]) |
13 | 14 | { |
14 | | - std::vector<std::string> args = emp::cl::args_to_strings(argc, argv); |
| 15 | + emp::vector<std::string> args = emp::cl::args_to_strings(argc, argv); |
15 | 16 | const bool verbose = emp::cl::use_arg(args, "-v"); |
16 | 17 |
|
17 | 18 | const auto & test_map = emp::GetHueMap(30); |
18 | 19 | const auto & test_map2 = emp::GetHueMap(60); |
| 20 | + const auto & test_map3 = emp::GetHSLMap(30); |
| 21 | + const auto & test_map4 = emp::GetHSLMap(60); |
19 | 22 |
|
20 | | - for (int i = 0; i < (int) test_map.size(); i++) { |
21 | | - std::cout << test_map[i] << std::endl; |
| 23 | + for (size_t i = 0; i < test_map.size(); ++i) { |
| 24 | + if (verbose) std::cout << test_map[i] << std::endl; |
22 | 25 | } |
| 26 | + for (size_t i = 0; i < test_map2.size(); ++i) { |
| 27 | + if (verbose) std::cout << test_map2[i] << std::endl; |
| 28 | + } |
| 29 | + for (size_t i = 0; i < test_map3.size(); ++i) { |
| 30 | + if (verbose) std::cout << test_map3[i] << std::endl; |
| 31 | + } |
| 32 | + for (size_t i = 0; i < test_map4.size(); ++i) { |
| 33 | + if (verbose) std::cout << test_map4[i] << std::endl; |
| 34 | + } |
| 35 | + |
| 36 | + emp_assert(emp::ColorRGB(255,255,255) == "#ffffff"); |
| 37 | + emp_assert(emp::ColorRGB(0,0,0) == "#000000"); |
| 38 | + emp_assert(emp::ColorRGB(0,255,0) == "#00ff00"); |
| 39 | + emp_assert(emp::ColorRGB(26,28,147) == "#1a1c93"); |
| 40 | + emp_assert(emp::ColorRGB(175,175,144) == "#afaf90"); |
| 41 | + emp_assert(emp::ColorRGB(195,30,204) == "#c31ecc"); |
| 42 | + emp_assert(emp::ColorRGB(195,0,204) == "#c300cc"); |
| 43 | + emp_assert(emp::ColorRGB(195,0,255) == "#c300ff"); |
| 44 | + |
| 45 | + emp_assert(emp::ColorRGB(255,255,255,0.5) == "rgba(255,255,255,0.5)"); |
| 46 | + emp_assert(emp::ColorRGB(255,255,255,1.0) == "rgba(255,255,255,1)"); |
| 47 | + emp_assert(emp::ColorRGB(26,28,147,0.5) == "rgba(26,28,147,0.5)"); |
| 48 | + emp_assert(emp::ColorRGB(26,28,147,1.0) == "rgba(26,28,147,1)"); |
| 49 | + |
| 50 | + emp_assert(emp::ColorHSL(198,100,100) == "hsl(198,100%,100%)"); |
| 51 | + emp_assert(emp::ColorHSL(18,0,10) == "hsl(18,0%,10%)"); |
| 52 | + emp_assert(emp::ColorHSL(360,6,10) == "hsl(360,6%,10%)"); |
| 53 | + emp_assert(emp::ColorHSL(0,6,10) == "hsl(0,6%,10%)"); |
| 54 | + |
| 55 | + emp_assert(emp::ColorHSV(0,0,1.0) == "#ffffff"); |
| 56 | + emp_assert(emp::ColorHSV(99.0,0,1.0) == "#ffffff"); |
| 57 | + emp_assert(emp::ColorHSV(360.0,0,1.0) == "#ffffff"); |
| 58 | + emp_assert(emp::ColorHSV(0,0,0) == "#000000"); |
| 59 | + emp_assert(emp::ColorHSV(0.3333*360,1.0,1.0) == "#00ff00"); |
| 60 | + emp_assert(emp::ColorHSV(0.6639*360,0.8231,0.5765) == "#1a1c93"); |
| 61 | + emp_assert(emp::ColorHSV(0.1667*360,0.1771,0.6863) == "#afaf90"); |
| 62 | + emp_assert(emp::ColorHSV(297,0.85,0.8000) == "#c31ecc"); |
| 63 | + emp_assert(emp::ColorHSV(0.8260*360,1.0,0.8000) == "#c300cc"); |
| 64 | + emp_assert(emp::ColorHSV(286,1.0,1.0) == "#c300ff"); |
| 65 | + |
| 66 | + return 0; |
23 | 67 | } |
0 commit comments