/* * Copyright 2015-2017 Michele "King_DuckZ" Santullo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "vectorwrapper/vectorwrapper.hpp" #include namespace { struct VecType { int a, b, c; }; } //unnamed namespace namespace vwr { template <> struct VectorWrapperInfo { enum { dimensions = 3}; typedef int scalar_type; typedef int storage_type[3]; enum { offset_x = offsetof(VecType, a), offset_y = offsetof(VecType, b), offset_z = offsetof(VecType, c) }; }; } //namespace vwr namespace { typedef vwr::Vec ivec3; } //unnamed namespace TEST(vwr, custom_storage_type) { ivec3 v(55); EXPECT_EQ(v.x(), 55); EXPECT_EQ(v.y(), 55); EXPECT_EQ(v.z(), 55); auto& data = v.data(); }