summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests/accumulatortests.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2012-12-05 18:55:25 -0500
committerMathias Stearn <mathias@10gen.com>2012-12-10 18:54:04 -0500
commit459467c7cf47b57d8990eeb41c65b4e203e15b65 (patch)
treee1b969346a3c8f42ff60a078469b86316dd3c3c0 /src/mongo/dbtests/accumulatortests.cpp
parentfefb4334afe40664438668a289c6daed6813b3c3 (diff)
downloadmongo-459467c7cf47b57d8990eeb41c65b4e203e15b65.tar.gz
Normalize handling of Undefined vs EOO/missing in agg
Related tickets: SERVER-6571 replace use of Undefined as missing with EOO SERVER-6471 ignore nullish values in $min and $max accumulators SERVER-6144 divide by zero makes field disappear (this solution isn't final)
Diffstat (limited to 'src/mongo/dbtests/accumulatortests.cpp')
-rw-r--r--src/mongo/dbtests/accumulatortests.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mongo/dbtests/accumulatortests.cpp b/src/mongo/dbtests/accumulatortests.cpp
index efec273c197..a4e29f107d2 100644
--- a/src/mongo/dbtests/accumulatortests.cpp
+++ b/src/mongo/dbtests/accumulatortests.cpp
@@ -359,13 +359,13 @@ namespace AccumulatorTests {
}
};
- /* The accumulator evaluates one document with the field missing retains undefined. */
+ /* The accumulator evaluates one document with the field missing, returns missing value. */
class Missing : public Base {
public:
void run() {
createAccumulator();
accumulator()->evaluate( fromjson( "{}" ) );
- ASSERT_EQUALS( Undefined, accumulator()->getValue().getType() );
+ ASSERT_EQUALS( EOO, accumulator()->getValue().getType() );
}
};
@@ -380,14 +380,14 @@ namespace AccumulatorTests {
}
};
- /* The accumulator evaluates two documents and retains the undefined value in the first. */
+ /* The accumulator evaluates two documents and retains the missing value in the first. */
class FirstMissing : public Base {
public:
void run() {
createAccumulator();
accumulator()->evaluate( fromjson( "{}" ) );
accumulator()->evaluate( fromjson( "{a:7}" ) );
- ASSERT_EQUALS( Undefined, accumulator()->getValue().getType() );
+ ASSERT_EQUALS( EOO, accumulator()->getValue().getType() );
}
};
@@ -433,7 +433,7 @@ namespace AccumulatorTests {
void run() {
createAccumulator();
accumulator()->evaluate( fromjson( "{}" ) );
- ASSERT_EQUALS( Undefined, accumulator()->getValue().getType() );
+ ASSERT_EQUALS( EOO , accumulator()->getValue().getType() );
}
};
@@ -455,7 +455,7 @@ namespace AccumulatorTests {
createAccumulator();
accumulator()->evaluate( fromjson( "{b:7}" ) );
accumulator()->evaluate( fromjson( "{}" ) );
- ASSERT_EQUALS( Undefined, accumulator()->getValue().getType() );
+ ASSERT_EQUALS( EOO , accumulator()->getValue().getType() );
}
};
@@ -501,7 +501,7 @@ namespace AccumulatorTests {
void run() {
createAccumulator();
accumulator()->evaluate( fromjson( "{}" ) );
- ASSERT_EQUALS( Undefined, accumulator()->getValue().getType() );
+ ASSERT_EQUALS( EOO , accumulator()->getValue().getType() );
}
};
@@ -523,7 +523,7 @@ namespace AccumulatorTests {
createAccumulator();
accumulator()->evaluate( fromjson( "{c:7}" ) );
accumulator()->evaluate( fromjson( "{}" ) );
- ASSERT_EQUALS( Undefined, accumulator()->getValue().getType() );
+ ASSERT_EQUALS( 7 , accumulator()->getValue().getInt() );
}
};
@@ -569,7 +569,7 @@ namespace AccumulatorTests {
void run() {
createAccumulator();
accumulator()->evaluate( fromjson( "{}" ) );
- ASSERT_EQUALS( Undefined, accumulator()->getValue().getType() );
+ ASSERT_EQUALS( EOO, accumulator()->getValue().getType() );
}
};