mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix some warnings, Add headers to the solution
This commit is contained in:
parent
093076c6d0
commit
ec7453ae85
@ -7,7 +7,14 @@ set(lib_SRCS
|
|||||||
ERMScriptModule.cpp
|
ERMScriptModule.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(vcmiERM SHARED ${lib_SRCS})
|
set(lib_HDRS
|
||||||
|
StdInc.h
|
||||||
|
ERMParser.h
|
||||||
|
ERMInterpreter.h
|
||||||
|
ERMScriptModule.h
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(vcmiERM SHARED ${lib_SRCS} ${lib_HDRS})
|
||||||
target_link_libraries(vcmiERM ${Boost_LIBRARIES} vcmi)
|
target_link_libraries(vcmiERM ${Boost_LIBRARIES} vcmi)
|
||||||
|
|
||||||
vcmi_set_output_dir(vcmiERM "scripting")
|
vcmi_set_output_dir(vcmiERM "scripting")
|
||||||
|
@ -1282,7 +1282,7 @@ namespace ERMConverter
|
|||||||
|
|
||||||
ERM::Tidentifier tid = trig.identifier.get();
|
ERM::Tidentifier tid = trig.identifier.get();
|
||||||
|
|
||||||
if(tid.size() == 0)
|
if(tid.empty())
|
||||||
throw EInterpreterError("Function must have identifier");
|
throw EInterpreterError("Function must have identifier");
|
||||||
|
|
||||||
Variable v = boost::apply_visitor(LVL1IexpToVar(), tid[0]);
|
Variable v = boost::apply_visitor(LVL1IexpToVar(), tid[0]);
|
||||||
@ -1432,7 +1432,7 @@ bool ERMInterpreter::isATrigger( const ERM::TLine & line )
|
|||||||
case 0: //v-exp
|
case 0: //v-exp
|
||||||
{
|
{
|
||||||
TVExp vexp = boost::get<TVExp>(line);
|
TVExp vexp = boost::get<TVExp>(line);
|
||||||
if(vexp.children.size() == 0)
|
if(vexp.children.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (getExpType(vexp.children[0]))
|
switch (getExpType(vexp.children[0]))
|
||||||
@ -1614,7 +1614,7 @@ namespace VERMInterpreter
|
|||||||
if(asSymbol)
|
if(asSymbol)
|
||||||
{
|
{
|
||||||
children.resize(children.size()+1);
|
children.resize(children.size()+1);
|
||||||
for(int i=children.size()-1; i >0; i--)
|
for(auto i=children.size()-1; i >0; i--)
|
||||||
{
|
{
|
||||||
children[i] = children[i-1];
|
children[i] = children[i-1];
|
||||||
}
|
}
|
||||||
@ -1718,7 +1718,7 @@ namespace VERMInterpreter
|
|||||||
}
|
}
|
||||||
VOption OptionConverterVisitor::operator()( ERM::TSymbol const& cmd ) const
|
VOption OptionConverterVisitor::operator()( ERM::TSymbol const& cmd ) const
|
||||||
{
|
{
|
||||||
if(cmd.symModifier.size() == 0)
|
if(cmd.symModifier.empty())
|
||||||
return VSymbol(cmd.sym);
|
return VSymbol(cmd.sym);
|
||||||
else
|
else
|
||||||
return VNode(cmd);
|
return VNode(cmd);
|
||||||
|
@ -187,7 +187,8 @@ std::vector<LineInfo> ERMParser::parseFile(CERMPreprocessor & preproc)
|
|||||||
}
|
}
|
||||||
catch (ParseErrorException & e)
|
catch (ParseErrorException & e)
|
||||||
{
|
{
|
||||||
logGlobal->error("Stopped parsing file.");
|
logGlobal->error("ERM Parser Error. File: '%s' Line: %d Exception: '%s'"
|
||||||
|
, preproc.getCurFileName(), preproc.getCurLineNo(), e.what());
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -37,6 +37,11 @@ public:
|
|||||||
{
|
{
|
||||||
return lineNo;
|
return lineNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& getCurFileName() const
|
||||||
|
{
|
||||||
|
return fname;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//various classes that represent ERM/VERM AST
|
//various classes that represent ERM/VERM AST
|
||||||
|
@ -40,9 +40,11 @@ set(test_SRCS
|
|||||||
erm/ERM_MF.cpp
|
erm/ERM_MF.cpp
|
||||||
erm/ERM_TM_T.cpp
|
erm/ERM_TM_T.cpp
|
||||||
erm/ERM_VR.cpp
|
erm/ERM_VR.cpp
|
||||||
|
erm/ERM_UN.cpp
|
||||||
erm/ERMPersistenceTest.cpp
|
erm/ERMPersistenceTest.cpp
|
||||||
erm/ExamplesTest.cpp
|
erm/ExamplesTest.cpp
|
||||||
erm/interpretter/ERM_VR.cpp
|
erm/interpretter/ERM_VR.cpp
|
||||||
|
erm/interpretter/ERM_UN.cpp
|
||||||
erm/interpretter/ErmRunner.cpp
|
erm/interpretter/ErmRunner.cpp
|
||||||
|
|
||||||
events/ApplyDamageTest.cpp
|
events/ApplyDamageTest.cpp
|
||||||
|
28
test/erm/interpretter/ERM_UN.cpp
Normal file
28
test/erm/interpretter/ERM_UN.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* ERM_UN.cpp, part of VCMI engine
|
||||||
|
*
|
||||||
|
* Authors: listed in file AUTHORS in main folder
|
||||||
|
*
|
||||||
|
* License: GNU General Public License v2.0 or later
|
||||||
|
* Full text of license available in license.txt file, in main folder
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "StdInc.h"
|
||||||
|
#include "ErmRunner.h"
|
||||||
|
|
||||||
|
namespace test
|
||||||
|
{
|
||||||
|
namespace scripting
|
||||||
|
{
|
||||||
|
using namespace ::testing;
|
||||||
|
|
||||||
|
TEST(ERM_UN_B, AnyInteger_ShouldGenerateIntToStringConversionAndSetStatement)
|
||||||
|
{
|
||||||
|
LuaStrings lua = ErmRunner::convertErmToLua({ "!#UN:B;" });
|
||||||
|
ASSERT_EQ(lua.lines.size(), 9) << lua.text;
|
||||||
|
EXPECT_EQ(lua.lines[ErmRunner::REGULAR_INSTRUCTION_FIRST_LINE], "ERM.UN():B(x)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user