GitHub Viewer
/*******************************************************
* Copyright (c) 2018, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include
#include
#include
#include
#include
#include
using af::allTrue;
using af::array;
using af::constant;
using af::dim4;
using af::readArray;
using af::saveArray;
using std::complex;
using std::string;
using std::vector;
struct type_params {
string name;
af_dtype type;
double real;
double imag;
type_params(string n, af_dtype t, double r, double i = 0.)
: name(n), type(t), real(r), imag(i) {}
};
class ArrayIOType : public ::testing::TestWithParam {};
string getTypeName(
const ::testing::TestParamInfo info) {
return info.param.name;
}
INSTANTIATE_TEST_SUITE_P(
Types, ArrayIOType,
::testing::Values(type_params("f32", f32, 3.14f, 0),
type_params("f64", f64, 3.14, 0),
type_params("c32", c32, 3.0f, 4.5f),
type_params("c64", c64, 3.0, 4.5),
type_params("s32", s32, 11), type_params("u32", u32, 12),
type_params("u8", u8, 13), type_params("b8", b8, 1),
type_params("s64", s64, 15), type_params("u64", u64, 16),
type_params("s16", s16, 17), type_params("u16", u16, 18),
type_params("s8", s8, 19)),
getTypeName);
TEST_P(ArrayIOType, ReadType) {
type_params p = GetParam();
if (noDoubleTests(p.type)) GTEST_SKIP()