hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MultiMediaCountersTest.cpp
Go to the documentation of this file.
1 #include <MultiMediaCounters.h>
2 #include <gtest/gtest.h>
3 #include <iostream>
4 
5 template <typename T>
6 class MultiMediaCountersTest: public ::testing::Test{
7  protected:
8 
10 };
11 
12 typedef ::testing::Types<u_int16_t, u_int32_t, u_int64_t> TestTypes;
14 
16 {
17  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getImgCount());
18  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getVideoCount());
19  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getSoundCount());
20 }
21 
22 
24 {
25  TestFixture::multiMediaCounters.addMultimedia(1, 127);
26 
27  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getImgCount());
28  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getVideoCount());
29  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getSoundCount());
30 }
31 
32 
34 {
35  TestFixture::multiMediaCounters.addMultimedia(1, 256);
36 
37  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getImgCount());
38  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getVideoCount());
39  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getSoundCount());
40 }
41 
42 
44 {
45  TestFixture::multiMediaCounters.addMultimedia(1, 512);
46 
47  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getImgCount());
48  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getVideoCount());
49  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getSoundCount());
50 }
51 
52 
54 {
55  TestFixture::multiMediaCounters.addMultimedia(1, 256 + 512);
56 
57  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getImgCount());
58  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getVideoCount());
59  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getSoundCount());
60 }
61 
62 
63 TYPED_TEST (MultiMediaCountersTest, addManyEqualResources)
64 {
65  TestFixture::multiMediaCounters.addMultimedia(1, 256 + 512);
66  TestFixture::multiMediaCounters.addMultimedia(1, 255 + 256 + 512);
67 
68  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getImgCount());
69  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getVideoCount());
70  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getSoundCount());
71 }
72 
73 
75 {
76  TestFixture::multiMediaCounters.addMultimedia(1, 32);
77  TestFixture::multiMediaCounters.addMultimedia(2, 32 + 256 + 512);
78  TestFixture::multiMediaCounters.addMultimedia(3, 512);
79  TestFixture::multiMediaCounters.addMultimedia(4, 32 + 512);
80 
81  EXPECT_EQ(3U, TestFixture::multiMediaCounters.getImgCount());
82  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getVideoCount());
83  EXPECT_EQ(3U, TestFixture::multiMediaCounters.getSoundCount());
84 }
85 
86 
87 TYPED_TEST (MultiMediaCountersTest, addAndDeleteResource)
88 {
89  TestFixture::multiMediaCounters.addMultimedia(1, 32 + 256 + 512);
90  TestFixture::multiMediaCounters.delMultimedia(1);
91 
92  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getImgCount());
93  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getVideoCount());
94  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getSoundCount());
95 }
96 
97 
98 TYPED_TEST (MultiMediaCountersTest, addAndDeleteResources)
99 {
100  TestFixture::multiMediaCounters.addMultimedia(1, 32);
101  TestFixture::multiMediaCounters.addMultimedia(2, 32 + 256 + 512);
102  TestFixture::multiMediaCounters.addMultimedia(3, 512);
103  TestFixture::multiMediaCounters.addMultimedia(4, 32 + 512);
104  TestFixture::multiMediaCounters.delMultimedia(2);
105  TestFixture::multiMediaCounters.delMultimedia(3);
106 
107  EXPECT_EQ(2U, TestFixture::multiMediaCounters.getImgCount());
108  EXPECT_EQ(0U, TestFixture::multiMediaCounters.getVideoCount());
109  EXPECT_EQ(1U, TestFixture::multiMediaCounters.getSoundCount());
110 }