1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-26 12:08:52 -05:00
This commit is contained in:
hrocho 2018-02-08 00:52:16 +01:00
parent a530d98d8d
commit 77013bd354

View File

@ -86,7 +86,8 @@ const lest::test specification[] =
EXPECT(catima::_storage.get_index()==4); EXPECT(catima::_storage.get_index()==4);
}, },
CASE("test maximum storage"){ // this test assumes max storage = 50 CASE("test maximum storage"){
auto maxdata = catima::max_storage_data;
catima::Projectile p{12,6,6,1000}; catima::Projectile p{12,6,6,1000};
catima::Material water({ catima::Material water({
{1,1,2}, {1,1,2},
@ -98,18 +99,18 @@ const lest::test specification[] =
}); });
catima::_storage.Reset(); catima::_storage.Reset();
EXPECT(catima::_storage.get_index()==0); EXPECT(catima::_storage.get_index()==0);
for(int i=1;i<51;i++){ for(int i=1;i<maxdata+1;i++){
catima::Projectile p1{2*i,i,i,1000}; catima::Projectile p1{2*i,i,i,1000};
catima::_storage.Add(p1,graphite); catima::_storage.Add(p1,graphite);
EXPECT(catima::_storage.get_index()==i); EXPECT(catima::_storage.get_index()==i);
EXPECT(catima::_storage.GetN()==50); EXPECT(catima::_storage.GetN()==maxdata);
} }
EXPECT(catima::_storage.get_index()==50); EXPECT(catima::_storage.get_index()==maxdata);
for(int i=1;i<49;i++){ for(int i=1;i<maxdata-1;i++){
catima::Projectile p1{2*i,i,i,1000}; catima::Projectile p1{2*i,i,i,1000};
catima::_storage.Add(p1,water); catima::_storage.Add(p1,water);
EXPECT(catima::_storage.get_index()==i); EXPECT(catima::_storage.get_index()==i);
EXPECT(catima::_storage.GetN()==50); EXPECT(catima::_storage.GetN()==maxdata);
} }