Skip to content

Commit 6cf5180

Browse files
committed
fixed test 226 to produce stable order; fixed gtest model for json mixed array
1 parent dedd4ec commit 6cf5180

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/gtests/gtests_json.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,18 @@ TEST_F ( TJson, bson_rawblob )
594594
for (int i=0; i<4; ++i)
595595
ASSERT_EQ ( pValues[i], i);
596596

597-
// blob of mixed (must not work)
597+
// blob of mixed work to convert to wides type
598598
tst = Bson ( "[0,1,2,300000000000000,4]" );
599599
dBlob = bson::RawBlob ( tst );
600-
ASSERT_EQ ( dBlob.second, 0 ); // since values are different, Bson is mixed vector, which can't be blob
600+
ASSERT_EQ ( dBlob.second, 5 ); // since values are different, Bson is mixed vector, with widest type \ int64
601+
{
602+
auto pValues64 = ( int64_t * ) dBlob.first;
603+
ASSERT_EQ ( pValues64[0], 0);
604+
ASSERT_EQ ( pValues64[1], 1 );
605+
ASSERT_EQ ( pValues64[2], 2 );
606+
ASSERT_EQ ( pValues64[3], 300000000000000 );
607+
ASSERT_EQ ( pValues64[4], 4 );
608+
}
601609

602610
// blob of int64
603611
tst = Bson ( "[100000000000,100000000001,100000000002,100000000003,100000000004]" );

test/test_226/model.bin

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

test/test_226/test.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,12 @@ select *, bigint(j.b) as c from multi1 order by c asc facet id limit 0;;
391391
select *, j.b as c from multi1 order by c asc facet id limit 0;;
392392

393393
<!-- facet with json.field vs alias -->
394-
select id, j from fs1 where id &lt; 3 facet j.x facet j.x as x_val;;
395-
select id, j from dist_fs1 where id &lt; 3 facet j.x facet j.x as x_val;;
396-
select id, j from fs1 where id &lt; 3 facet j['x'] as x_val;;
394+
select id, j from fs1 where id &lt; 3 facet j.x order by FACET() asc facet j.x as x_val order by FACET() asc;;
395+
select id, j from dist_fs1 where id &lt; 3 facet j.x order by FACET() asc facet j.x as x_val order by FACET() asc;;
396+
select id, j from fs1 where id &lt; 3 facet j['x'] as x_val order by FACET() asc;;
397397

398-
select id, j from fs2 facet j.key;;
399-
select id, j from fs2 facet j.key as k;;
398+
select id, j from fs2 facet j.key order by FACET() asc;;
399+
select id, j from fs2 facet j.key as k order by FACET() asc;;
400400

401401
</sphinxql></queries>
402402

0 commit comments

Comments
 (0)