summaryrefslogtreecommitdiff
path: root/src/mongo/db/sorter
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/sorter')
-rw-r--r--src/mongo/db/sorter/sorter_test.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp
index 37bf118fe98..19171fb13ba 100644
--- a/src/mongo/db/sorter/sorter_test.cpp
+++ b/src/mongo/db/sorter/sorter_test.cpp
@@ -34,6 +34,7 @@
#include "mongo/base/data_type_endian.h"
#include "mongo/base/init.h"
+#include "mongo/base/static_assert.h"
#include "mongo/config.h"
#include "mongo/db/service_context.h"
#include "mongo/db/service_context_noop.h"
@@ -488,10 +489,8 @@ public:
SortOptions adjustSortOptions(SortOptions opts) {
// Make sure we use a reasonable number of files when we spill
- static_assert((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 50,
- "(NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 50");
- static_assert((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500,
- "(NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500");
+ MONGO_STATIC_ASSERT((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 50);
+ MONGO_STATIC_ASSERT((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500);
return opts.MaxMemoryUsageBytes(MEM_LIMIT).ExtSortAllowed();
}
@@ -527,17 +526,13 @@ class LotsOfDataWithLimit : public LotsOfDataLittleMemory<Random> {
typedef LotsOfDataLittleMemory<Random> Parent;
SortOptions adjustSortOptions(SortOptions opts) {
// Make sure our tests will spill or not as desired
- static_assert(MEM_LIMIT / 2 > (100 * sizeof(IWPair)),
- "MEM_LIMIT / 2 > (100 * sizeof(IWPair))");
- static_assert(MEM_LIMIT < (5000 * sizeof(IWPair)), "MEM_LIMIT < (5000 * sizeof(IWPair))");
- static_assert(MEM_LIMIT * 2 > (5000 * sizeof(IWPair)),
- "MEM_LIMIT * 2 > (5000 * sizeof(IWPair))");
+ MONGO_STATIC_ASSERT(MEM_LIMIT / 2 > (100 * sizeof(IWPair)));
+ MONGO_STATIC_ASSERT(MEM_LIMIT < (5000 * sizeof(IWPair)));
+ MONGO_STATIC_ASSERT(MEM_LIMIT * 2 > (5000 * sizeof(IWPair)));
// Make sure we use a reasonable number of files when we spill
- static_assert((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 100,
- "(Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 100");
- static_assert((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500,
- "(Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500");
+ MONGO_STATIC_ASSERT((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 100);
+ MONGO_STATIC_ASSERT((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500);
return opts.MaxMemoryUsageBytes(MEM_LIMIT).ExtSortAllowed().Limit(Limit);
}