summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/prettyfloat/prettyfloat.cpp
blob: a84ac59c964bd6d85c7dc2363e386e9ed36737a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/log/log.h>
LOG_SETUP("prettyfloat_test");
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/searchlib/util/rawbuf.h>
#include <vespa/searchlib/common/hitrank.h>

using namespace search;

TEST_SETUP(Test);

int
Test::Main()
{
    TEST_INIT("prettyfloat_test");
    {
        RawBuf buf(5000);
        SignedHitRank rank = 10;
        buf.addSignedHitRank(rank);
        *buf.GetWritableFillPos() = '\0';
        EXPECT_EQUAL(std::string("10"), buf.GetDrainPos());
    }
    {
        RawBuf buf(5000);
        HitRank rank = 10;
        buf.addHitRank(rank);
        *buf.GetWritableFillPos() = '\0';
        EXPECT_EQUAL(std::string("10"), buf.GetDrainPos());
    }
    TEST_DONE();
}