comparison UnitTestsSources/UnitTestsMain.cpp @ 66:a92e96943496

fix warnings
author jodogne
date Tue, 04 Aug 2015 14:33:45 +0200
parents a6492d20b2a8
children abdde1dfb3eb
comparison
equal deleted inserted replaced
65:78aa0a355d3a 66:a92e96943496
99 99
100 TEST_F(CacheManagerTest, DefaultQuota) 100 TEST_F(CacheManagerTest, DefaultQuota)
101 { 101 {
102 std::set<std::string> f; 102 std::set<std::string> f;
103 GetStorage().ListAllFiles(f); 103 GetStorage().ListAllFiles(f);
104 ASSERT_EQ(0, f.size()); 104 ASSERT_EQ(0u, f.size());
105 105
106 GetCache().SetDefaultQuota(10, 0); 106 GetCache().SetDefaultQuota(10, 0);
107 for (unsigned int i = 0; i < 30; i++)
108 {
109 GetStorage().ListAllFiles(f);
110 ASSERT_EQ(i >= 10 ? 10u : i, f.size());
111 std::string s = boost::lexical_cast<std::string>(i);
112 GetCache().Store(0, s, "Test " + s);
113 }
114
115 GetStorage().ListAllFiles(f);
116 ASSERT_EQ(10u, f.size());
117
107 for (int i = 0; i < 30; i++) 118 for (int i = 0; i < 30; i++)
108 { 119 {
109 GetStorage().ListAllFiles(f); 120 ASSERT_EQ(i >= 20, GetCache().IsCached(0, boost::lexical_cast<std::string>(i)));
110 ASSERT_EQ(i >= 10 ? 10 : i, f.size()); 121 }
122
123 GetCache().SetDefaultQuota(5, 0);
124 GetStorage().ListAllFiles(f);
125 ASSERT_EQ(5u, f.size());
126 for (int i = 0; i < 30; i++)
127 {
128 ASSERT_EQ(i >= 25, GetCache().IsCached(0, boost::lexical_cast<std::string>(i)));
129 }
130
131 for (int i = 0; i < 15; i++)
132 {
111 std::string s = boost::lexical_cast<std::string>(i); 133 std::string s = boost::lexical_cast<std::string>(i);
112 GetCache().Store(0, s, "Test " + s); 134 GetCache().Store(0, s, "Test " + s);
113 } 135 }
114 136
115 GetStorage().ListAllFiles(f); 137 GetStorage().ListAllFiles(f);
116 ASSERT_EQ(10, f.size()); 138 ASSERT_EQ(5u, f.size());
117
118 for (int i = 0; i < 30; i++)
119 {
120 ASSERT_EQ(i >= 20, GetCache().IsCached(0, boost::lexical_cast<std::string>(i)));
121 }
122
123 GetCache().SetDefaultQuota(5, 0);
124 GetStorage().ListAllFiles(f);
125 ASSERT_EQ(5, f.size());
126 for (int i = 0; i < 30; i++)
127 {
128 ASSERT_EQ(i >= 25, GetCache().IsCached(0, boost::lexical_cast<std::string>(i)));
129 }
130
131 for (int i = 0; i < 15; i++)
132 {
133 std::string s = boost::lexical_cast<std::string>(i);
134 GetCache().Store(0, s, "Test " + s);
135 }
136
137 GetStorage().ListAllFiles(f);
138 ASSERT_EQ(5, f.size());
139 139
140 for (int i = 0; i < 50; i++) 140 for (int i = 0; i < 50; i++)
141 { 141 {
142 std::string s = boost::lexical_cast<std::string>(i); 142 std::string s = boost::lexical_cast<std::string>(i);
143 if (i >= 10 && i < 15) 143 if (i >= 10 && i < 15)
165 GetCache().Store(0, s, "Test " + s); 165 GetCache().Store(0, s, "Test " + s);
166 } 166 }
167 167
168 std::set<std::string> f; 168 std::set<std::string> f;
169 GetStorage().ListAllFiles(f); 169 GetStorage().ListAllFiles(f);
170 ASSERT_EQ(10, f.size()); 170 ASSERT_EQ(10u, f.size());
171 171
172 GetCache().Invalidate(0, "25"); 172 GetCache().Invalidate(0, "25");
173 GetStorage().ListAllFiles(f); 173 GetStorage().ListAllFiles(f);
174 ASSERT_EQ(9, f.size()); 174 ASSERT_EQ(9u, f.size());
175 for (int i = 0; i < 50; i++) 175 for (int i = 0; i < 50; i++)
176 { 176 {
177 std::string s = boost::lexical_cast<std::string>(i); 177 std::string s = boost::lexical_cast<std::string>(i);
178 ASSERT_EQ((i >= 20 && i < 30 && i != 25), GetCache().IsCached(0, s)); 178 ASSERT_EQ((i >= 20 && i < 30 && i != 25), GetCache().IsCached(0, s));
179 } 179 }
182 { 182 {
183 GetCache().Invalidate(0, boost::lexical_cast<std::string>(i)); 183 GetCache().Invalidate(0, boost::lexical_cast<std::string>(i));
184 } 184 }
185 185
186 GetStorage().ListAllFiles(f); 186 GetStorage().ListAllFiles(f);
187 ASSERT_EQ(0, f.size()); 187 ASSERT_EQ(0u, f.size());
188 } 188 }
189 189
190 190
191 191
192 TEST(JpegWriter, Basic) 192 TEST(JpegWriter, Basic)