66TEST_SUITE_BEGIN (" Game_Destiny" );
77
88
9- static const lcf::rpg::EventCommand* MakeCommand (
9+ static lcf::rpg::EventCommand MakeCommand (
1010 const lcf::rpg::EventCommand::Code code,
1111 const std::string& string
1212)
1313{
14- lcf::rpg::EventCommand* cmd = new lcf::rpg::EventCommand ;
14+ lcf::rpg::EventCommand cmd;
1515 lcf::DBString dbStr (string);
1616
17- cmd-> code = static_cast <uint32_t >(code);
18- cmd-> string = dbStr;
17+ cmd. code = static_cast <uint32_t >(code);
18+ cmd. string = dbStr;
1919
2020 return cmd;
2121}
2222
23- static lcf::rpg::SaveEventExecFrame* MakeFrame (
23+ static lcf::rpg::SaveEventExecFrame MakeFrame (
2424 std::vector<std::string>::const_iterator begin,
2525 std::vector<std::string>::const_iterator end
2626)
2727{
28- lcf::rpg::SaveEventExecFrame* frame = new lcf::rpg::SaveEventExecFrame ;
28+ lcf::rpg::SaveEventExecFrame frame;
2929 lcf::rpg::EventCommand::Code code;
3030
3131 code = lcf::rpg::EventCommand::Code::Comment;
@@ -34,7 +34,7 @@ static lcf::rpg::SaveEventExecFrame* MakeFrame(
3434 {
3535 const std::string& str = *begin++;
3636
37- frame-> commands .push_back (* MakeCommand (code, str));
37+ frame. commands .push_back (MakeCommand (code, str));
3838 code = lcf::rpg::EventCommand::Code::Comment_2;
3939 }
4040
@@ -49,18 +49,14 @@ TEST_CASE("AssertDestinyScript")
4949 " $" ,
5050 " v[1] = 10;" ,
5151 };
52- lcf::rpg::SaveEventExecFrame* frame;
5352 const char * destinyScript;
5453
55- frame = MakeFrame (lines.begin (), lines.end ());
56- destinyScript = destiny.Interpreter ().MakeString (* frame);
54+ auto frame = MakeFrame (lines.begin (), lines.end ());
55+ destinyScript = destiny.Interpreter ().MakeString (frame);
5756
5857 CHECK_EQ (*destinyScript, ' $' );
5958
6059 destiny.Interpreter ().FreeString ();
61- delete frame;
62- frame = nullptr ;
6360}
6461
65-
6662TEST_SUITE_END ();
0 commit comments