Refactor and fix tests

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 3166c8e162
commit 1651452c34
  1. BIN
      C++ProjectTemplate
  2. 3
      defines.h
  3. 5
      main.cpp
  4. 12
      test/test.cpp

Binary file not shown.

@ -17,6 +17,9 @@ using namespace olc;
#define DEFAULT_CHANNELPOS {-99,-99}
#define CUSTOM_MESSAGE_WAIT_TIME 90
#define SetupMove(movename) MOVELIST[BattleMoveName::movename]=new Battle::Move{BattleMoveName::movename,
#define SetupItem(itemname) ITEMLIST[ItemName::itemname]=new Item(ItemName::itemname,
#define 돈
#define α '`'

@ -17,7 +17,7 @@
#include "SeasonI.h"
#include "trigger.h"
//#include "test/test.h"
#include "test/test.h"
#ifndef TEST_SUITE
#define OLC_PGE_APPLICATION
@ -28,9 +28,6 @@
#include "defines.h"
#endif
#define SetupMove(movename) MOVELIST[BattleMoveName::movename]=new Battle::Move{BattleMoveName::movename,
#define SetupItem(itemname) ITEMLIST[ItemName::itemname]=new Item(ItemName::itemname,
using namespace olc;
struct SaveFileData{

@ -27,7 +27,7 @@ extern std::array<Entity*,7> PARTY_MEMBER_STATS;
extern Entity::pstats_t partyMemberDefaultStats;
extern std::map<std::string,Decal*> SPRITES;
extern std::map<std::string,Animation*> ANIMATIONS;
extern std::array<Object*,4> PARTY_MEMBER_OBJ;
extern std::array<NPC_Obj*,4> PARTY_MEMBER_OBJ;
extern std::map<int,Object*> OBJ_INFO;
extern std::map<BattleMoveName,Battle::Move*>MOVELIST;
extern std::vector<Encounter*>ENCOUNTER_LIST;
@ -80,7 +80,7 @@ bool SeasonI::OnUserCreate(){
Test("Party Member Object is not setup",
PARTY_MEMBER_OBJ[0]==nullptr);
vd2d testPos={0,0},testScale={2,2};
CreateObjectInfo(new Standard_Obj(PLAYER,"player",testPos,nullptr,testScale,MAGENTA,32),"player.png",32);
CreateObjectInfo(new Standard_Obj(PLAYER,"player",testPos,nullptr,testScale,MAGENTA,32),"player.png",{24,32});
Test("Player animation is defined",
ANIMATIONS["player.png"]!=nullptr);
Decal*playerAnimPointer=ANIMATIONS["player.png"]->spr;
@ -89,7 +89,7 @@ bool SeasonI::OnUserCreate(){
Test("Object Info database now has 1 entry",
OBJ_INFO.size()==1);
Test("Object Info is correctly assigned",
OBJ_INFO[0]->name=="player"&&OBJ_INFO[0]->id==PLAYER&&OBJ_INFO[0]->GetPos()==testPos&&OBJ_INFO[0]->GetScale()==testScale&&OBJ_INFO[0]->color==MAGENTA&&OBJ_INFO[0]->spr->width==32);
OBJ_INFO[0]->name=="player"&&OBJ_INFO[0]->id==PLAYER&&OBJ_INFO[0]->GetPos()==testPos&&OBJ_INFO[0]->GetScale()==testScale&&OBJ_INFO[0]->color==MAGENTA&&OBJ_INFO[0]->spr->sprSize.x==24&&OBJ_INFO[0]->spr->sprSize.y==32);
delete OBJ_INFO[PLAYER];
OBJ_INFO.erase(PLAYER);
Test("Object Info is cleared",
@ -174,7 +174,7 @@ bool SeasonI::OnUserCreate(){
MOVELIST.count(BattleMoveName::TESTMOVE1));
Test("Test Move 1 is undefined",
MOVELIST[BattleMoveName::TESTMOVE1]==nullptr);
MOVELIST[BattleMoveName::TESTMOVE1]=new Battle::Move{"Test Move 1","An attack",baseDmg:30,randomDmg:5,range:6,channelTime:27,friendly:false};
MOVELIST[BattleMoveName::TESTMOVE1]=SetupMove(TESTMOVE1)"Test Move 1","An attack",baseDmg:30,randomDmg:5,range:6,channelTime:27,friendly:false};
Test("Verify Test Move 1's now set properly",
MOVELIST[BattleMoveName::TESTMOVE1]!=nullptr);
Test("Verify Test Move 1's Power Name shows up correctly",
@ -189,7 +189,7 @@ bool SeasonI::OnUserCreate(){
ITEMLIST[ItemName::COOKIE]!=nullptr);
delete ITEMLIST[ItemName::COOKIE];
ITEMLIST.erase(ItemName::COOKIE);
ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",2,{hpRecovery:40,consumable:Consumable::FRIENDLY,sellPrice:2});
ITEMLIST[ItemName::COOKIE]=SetupItem(COOKIE)"Cookie","A delightful little treat. Restores 40 HP.",2,{hpRecovery:40,consumable:Consumable::FRIENDLY,sellPrice:2});
Test("Cookie name is set properly",
ITEMLIST[ItemName::COOKIE]->name=="Cookie");
Test("Cookie description is set properly",
@ -198,7 +198,7 @@ bool SeasonI::OnUserCreate(){
ITEMLIST[ItemName::COOKIE]->dropChance==2);
delete ITEMLIST[ItemName::FREEZE_PACKET];
ITEMLIST.erase(ItemName::FREEZE_PACKET);
ITEMLIST[ItemName::FREEZE_PACKET]=new Item("Freeze Packet","Lets out some blistering cold weather.",256,{consumable:Consumable::ENEMY,sellPrice:36},MOVELIST[BattleMoveName::FREEZE_PACKET]);
ITEMLIST[ItemName::FREEZE_PACKET]=SetupItem(FREEZE_PACKET)"Freeze Packet","Lets out some blistering cold weather.",256,{consumable:Consumable::ENEMY,sellPrice:36},MOVELIST[BattleMoveName::FREEZE_PACKET]);
Test("Freeze Packet name is set properly",
ITEMLIST[ItemName::FREEZE_PACKET]->name=="Freeze Packet");
Test("Freeze Packet description is set properly",

Loading…
Cancel
Save