1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gpu/command_buffer/service/context_state.h"
7 #include "testing/gtest/include/gtest/gtest.h"
12 TEST(ContextStateVec4Test
, DefaultValues
) {
14 EXPECT_EQ(Vec4::kFloat
, v
.type());
23 TEST(ContextStateVec4Test
, SetGetFloatValues
) {
26 const GLfloat kFloatValues
[4] = { 2.f
, 3.f
, 4.f
, 5.f
};
27 v
.SetValues(kFloatValues
);
28 EXPECT_EQ(Vec4::kFloat
, v
.type());
31 for (size_t ii
= 0; ii
< 4; ++ii
) {
32 EXPECT_EQ(kFloatValues
[ii
], fv
[ii
]);
36 TEST(ContextStateVec4Test
, SetGetIntValues
) {
39 const GLint kIntValues
[4] = { 2, 3, -4, 5 };
40 v
.SetValues(kIntValues
);
41 EXPECT_EQ(Vec4::kInt
, v
.type());
44 for (size_t ii
= 0; ii
< 4; ++ii
) {
45 EXPECT_EQ(kIntValues
[ii
], iv
[ii
]);
49 TEST(ContextStateVec4Test
, SetGetUIntValues
) {
52 const GLuint kUIntValues
[4] = { 2, 3, 4, 5 };
53 v
.SetValues(kUIntValues
);
54 EXPECT_EQ(Vec4::kUInt
, v
.type());
57 for (size_t ii
= 0; ii
< 4; ++ii
) {
58 EXPECT_EQ(kUIntValues
[ii
], uiv
[ii
]);
62 TEST(ContextStateVec4Test
, Equal
) {
65 const GLint kIntValues
[4] = { 2, 3, 4, 5 };
66 const GLuint kUIntValues
[4] = { 2, 3, 4, 5 };
68 v1
.SetValues(kIntValues
);
69 v2
.SetValues(kUIntValues
);
70 EXPECT_FALSE(v1
.Equal(v2
));
71 EXPECT_FALSE(v2
.Equal(v1
));
73 v2
.SetValues(kIntValues
);
74 EXPECT_TRUE(v1
.Equal(v2
));
75 EXPECT_TRUE(v2
.Equal(v1
));
77 const GLint kIntValues2
[4] = { 2, 3, 4, 6 };
78 v2
.SetValues(kIntValues2
);
79 EXPECT_FALSE(v1
.Equal(v2
));
80 EXPECT_FALSE(v2
.Equal(v1
));