File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ 1
Original file line number Diff line number Diff line change 1+ # String comparisons
2+ STRING("1") NEWLINE
3+ SET(x = "abc")
4+ SET(y = "hello")
5+ ASSERT(x < "b")
6+ ASSERT(y >= "helln")
7+ ASSERT(x != y)
Original file line number Diff line number Diff line change @@ -82,6 +82,22 @@ class Value {
8282 else if constexpr (op == checktestdataParser::OR)
8383 return Value{a || b};
8484 }
85+ if constexpr (std::is_same_v<T, string> &&
86+ std::is_same_v<U, string>) {
87+ if constexpr (op == checktestdataParser::EQ) {
88+ return Value{a == b};
89+ } else if constexpr (op == checktestdataParser::NE) {
90+ return Value{a != b};
91+ } else if constexpr (op == checktestdataParser::LE) {
92+ return Value{a <= b};
93+ } else if constexpr (op == checktestdataParser::LT) {
94+ return Value{a < b};
95+ } else if constexpr (op == checktestdataParser::GE) {
96+ return Value{a >= b};
97+ } else if constexpr (op == checktestdataParser::GT) {
98+ return Value{a > b};
99+ }
100+ }
85101 if constexpr (!is_numeric<T> || !is_numeric<U>) {
86102 throw std::invalid_argument (" invalid operands" );
87103 } else {
You can’t perform that action at this time.
0 commit comments