google / cel-cpp

Fast, portable, non-Turing complete expression evaluation (C++)
https://cel.dev
Apache License 2.0
159 stars 47 forks source link

Add a test matcher for the elements of cel::ListValue and cel::MapValue. #790

Closed copybara-service[bot] closed 1 week ago

copybara-service[bot] commented 1 week ago

Add a test matcher for the elements of cel::ListValue and cel::MapValue.

Instead of manually unwrapping a list or map to test their contents, they can now be matched with ListValueElements and MapValueElements, e.g.:

ASSERT_THAT(l, ListValueIs(ListValueElements(&mgr, ElementsAre(x1, x2, ...)));

ASSERT_THAT(l, MapValueIs(MapValueElements(&mgr, UnorderedElementsAre(Pair(k1, v1), ...)));