1 /** 2 A module with tests to test the compile-time reflection 3 */ 4 5 module unit_threaded.tests.parametrized; 6 7 import unit_threaded.attrs; 8 9 version(unittest) { 10 11 @(1, 2, 3) 12 @AutoTags 13 void testValues(int i) { 14 assert(i % 2 != 0); 15 } 16 17 @Types!(float, int) 18 @AutoTags 19 void testTypes(T)() { 20 assert(T.init == 0); 21 } 22 } 23 24 @("builtinIntValues") 25 @AutoTags 26 @Values(2, 3, 4, 5) 27 unittest { 28 import std.conv; 29 immutable i = getValue!int; 30 assert(i == 3); 31 } 32 33 @("cartesianBuiltinNoAutoTags") 34 @Values("foo", "bar") 35 @Values("red", "blue", "green") 36 unittest { 37 assert(getValue!(string, 0).length == getValue!(string, 1).length); 38 } 39 40 @("cartesianBuiltinAutoTags") 41 @Values("foo", "bar") 42 @Values("red", "blue", "green") 43 @AutoTags 44 unittest { 45 assert(getValue!(string, 0).length == getValue!(string, 1).length); 46 } 47 48 49 50 @(1, 2, 3) 51 @("foo", "bar") 52 @AutoTags 53 testCartesianFunction(int i, string s) { 54 assert(i == 2 && s == "bar"); 55 } 56 57 58 void testIssue31(int, string) { 59 // this used to fail because there are no UDAs on this function 60 }