@@ -873,21 +873,51 @@ namespace { // Anonymous namespace which is translation-unit-specific; certain s
873
873
874
874
#ifdef NO_ANTITHESIS_SDK
875
875
876
- #define ALWAYS (cond, message, ...)
877
- #define ALWAYS_OR_UNREACHABLE (cond, message, ...)
878
- #define SOMETIMES (cond, message, ...)
879
- #define REACHABLE (message, ...)
880
- #define UNREACHABLE (message, ...)
881
- #define ALWAYS_GREATER_THAN (val, threshold, message, ...)
882
- #define ALWAYS_GREATER_THAN_OR_EQUAL_TO (val, threshold, message, ...)
883
- #define SOMETIMES_GREATER_THAN (val, threshold, message, ...)
884
- #define SOMETIMES_GREATER_THAN_OR_EQUAL_TO (val, threshold, message, ...)
885
- #define ALWAYS_LESS_THAN (val, threshold, message, ...)
886
- #define ALWAYS_LESS_THAN_OR_EQUAL_TO (val, threshold, message, ...)
887
- #define SOMETIMES_LESS_THAN (val, threshold, message, ...)
888
- #define SOMETIMES_LESS_THAN_OR_EQUAL_TO (val, threshold, message, ...)
889
- #define ALWAYS_SOME (pairs, message, ...)
890
- #define SOMETIMES_ALL (pairs, message, ...)
876
+ #ifndef ANTITHESIS_SDK_ALWAYS_POLYFILL
877
+ #define ANTITHESIS_SDK_ALWAYS_POLYFILL
878
+ #endif
879
+
880
+ #ifndef ANTITHESIS_SDK_SOMETIMES_POLYFILL
881
+ #define ANTITHESIS_SDK_SOMETIMES_POLYFILL
882
+ #endif
883
+
884
+
885
+ #define ALWAYS (cond, message, ...) \
886
+ ANTITHESIS_SDK_ALWAYS_POLYFILL (cond, message, __VA_ARGS__)
887
+ #define ALWAYS_OR_UNREACHABLE (cond, message, ...) \
888
+ ANTITHESIS_SDK_ALWAYS_POLYFILL (cond, message, __VA_ARGS__)
889
+ #define SOMETIMES (cond, message, ...) \
890
+ ANTITHESIS_SDK_SOMETIMES_POLYFILL (cond, message, __VA_ARGS__)
891
+ #define REACHABLE (message, ...) \
892
+ ANTITHESIS_SDK_SOMETIMES_POLYFILL (true , message, __VA_ARGS__)
893
+ #define UNREACHABLE (message, ...) \
894
+ ANTITHESIS_SDK_ALWAYS_POLYFILL (false , message, __VA_ARGS__)
895
+ #define ALWAYS_GREATER_THAN (val, threshold, message, ...) \
896
+ ANTITHESIS_SDK_ALWAYS_POLYFILL ((val > threshold), message, __VA_ARGS__)
897
+ #define ALWAYS_GREATER_THAN_OR_EQUAL_TO (val, threshold, message, ...) \
898
+ ANTITHESIS_SDK_ALWAYS_POLYFILL ((val >= threshold), message, __VA_ARGS__)
899
+ #define SOMETIMES_GREATER_THAN (val, threshold, message, ...) \
900
+ ANTITHESIS_SDK_SOMETIMES_POLYFILL ((val > threshold), message, __VA_ARGS__)
901
+ #define SOMETIMES_GREATER_THAN_OR_EQUAL_TO (val, threshold, message, ...) \
902
+ ANTITHESIS_SDK_SOMETIMES_POLYFILL ((val >= threshold), message, __VA_ARGS__)
903
+ #define ALWAYS_LESS_THAN (val, threshold, message, ...) \
904
+ ANTITHESIS_SDK_ALWAYS_POLYFILL ((val < threshold), message, __VA_ARGS__)
905
+ #define ALWAYS_LESS_THAN_OR_EQUAL_TO (val, threshold, message, ...) \
906
+ ANTITHESIS_SDK_ALWAYS_POLYFILL ((val <= threshold), message, __VA_ARGS__)
907
+ #define SOMETIMES_LESS_THAN (val, threshold, message, ...) \
908
+ ANTITHESIS_SDK_SOMETIMES_POLYFILL ((val < threshold), message, __VA_ARGS__)
909
+ #define SOMETIMES_LESS_THAN_OR_EQUAL_TO (val, threshold, message, ...) \
910
+ ANTITHESIS_SDK_SOMETIMES_POLYFILL ((val <= threshold), message, __VA_ARGS__)
911
+ #define ALWAYS_SOME (pairs, message, ...) \
912
+ ANTITHESIS_SDK_ALWAYS_POLYFILL ([&](){ \
913
+ for (std::pair<std::string, bool > pair : pairs) \
914
+ if (pair.second ) return true ; \
915
+ return false ; }(), message, __VA_ARGS__)
916
+ #define SOMETIMES_ALL (pairs, message, ...) \
917
+ ANTITHESIS_SDK_SOMETIMES_POLYFILL ([&](){ \
918
+ for (std::pair<std::string, bool > pair : pairs) \
919
+ if (!pair.second ) return false ; \
920
+ return true ; }(), message, __VA_ARGS__)
891
921
892
922
#else
893
923
0 commit comments