aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils/test/QuantizeHelperTest.cpp
blob: 7e781d0b5d7421d65bfae5faea61cc0314ba30f5 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Copyright © 2019 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include <QuantizeHelper.hpp>

#include <boost/core/ignore_unused.hpp>
#include <boost/test/unit_test.hpp>

#include <vector>

BOOST_AUTO_TEST_SUITE(QuantizeHelper)

namespace
{

template<typename T>
bool IsFloatIterFunc(T iter)
{
    boost::ignore_unused(iter);
    return armnnUtils::IsFloatingPointIterator<T>::value;
}

} // anonymous namespace

BOOST_AUTO_TEST_CASE(IsFloatIterFuncTest)
{
    std::vector<float> fArray;
    BOOST_TEST(IsFloatIterFunc(fArray.begin()) == true);
    BOOST_TEST(IsFloatIterFunc(fArray.cbegin()) == true);

    std::vector<double> dArray;
    BOOST_TEST(IsFloatIterFunc(dArray.begin()) == true);

    std::vector<int> iArray;
    BOOST_TEST(IsFloatIterFunc(iArray.begin()) == false);

    float floats[5];
    BOOST_TEST(IsFloatIterFunc(&floats[0]) == true);

    int ints[5];
    BOOST_TEST(IsFloatIterFunc(&ints[0]) == false);
}

BOOST_AUTO_TEST_SUITE_END()