text: /*
   * test_if.cpp
   *
   *  Created on: 2020/03/14
   *      Author: iizuka
   */
  
  #include "test_utils/t_macros.h"
  
  #include "vm/VirtualMachine.h"
  #include "engine/sc/SmartContract.h"
  
  #include "base_io_stream/FileInputStream.h"
  
  #include "../VmTestUtils.h"
  #include "ext_binary/ExtClassObject.h"
  #include "ext_binary/ExtPrimitiveObject.h"
  
  #include "base/UnicodeString.h"
  
  
  using namespace alinous;
  
  
  TEST_GROUP(TestIfStmtGroup) {
  	TEST_SETUP(){}
  	TEST_TEARDOWN(){}
  };
  
  TEST(TestIfStmtGroup, case01){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case01/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(result)
  
  	result = util.createInstance();
  	CHECK(result)
  
  	ExtClassObject* obj = util.getMainExtObject(); __STP(obj);
  	int iresult = VmTestUtils::getIntMemberValue(obj, L"result");
  
  	CHECK(iresult == 1)
  }
  
  TEST(TestIfStmtGroup, case02){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case02/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(result)
  
  	result = util.createInstance();
  	CHECK(result)
  
  	ExtClassObject* obj = util.getMainExtObject(); __STP(obj);
  	int iresult = VmTestUtils::getIntMemberValue(obj, L"result");
  
  	CHECK(iresult == -1)
  }
  
  TEST(TestIfStmtGroup, case03){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case03/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(result)
  
  	result = util.createInstance();
  	CHECK(result)
  
  	ExtClassObject* obj = util.getMainExtObject(); __STP(obj);
  	int iresult = VmTestUtils::getIntMemberValue(obj, L"result");
  
  	CHECK(iresult == 2)
  }
  
  TEST(TestIfStmtGroup, case04){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case04/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(result)
  
  	result = util.createInstance();
  	CHECK(result)
  
  	ExtClassObject* obj = util.getMainExtObject(); __STP(obj);
  	int iresult = VmTestUtils::getIntMemberValue(obj, L"result");
  
  	CHECK(iresult == 3)
  }
  
  TEST(TestIfStmtGroup, case05){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case05/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(!result)
  }
  
  TEST(TestIfStmtGroup, case06){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case06/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(!result)
  }
  
  TEST(TestIfStmtGroup, case07){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case07/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(result)
  
  	result = util.createInstance();
  	CHECK(result)
  
  	ExtExceptionObject* exobj = util.vm->getUncaughtException(); __STP(exobj);
  	CHECK(exobj != nullptr)
  }
  
  TEST(TestIfStmtGroup, case08){
  	const File* projectFolder = this->env->getProjectRoot();
  	VmTestUtils util(L"src_test/smartcontract_vm/stmt_ctrl/resources/if/case08/", projectFolder);
  
  	util.loadAllFiles();
  	util.setMain(L"test.fw", L"SmartContract", L"main");
  
  	bool result = util.analyze();
  	CHECK(result)
  
  	result = util.createInstance();
  	CHECK(result)
  
  	ExtExceptionObject* exobj = util.vm->getUncaughtException(); __STP(exobj);
  	CHECK(exobj != nullptr)
  }
  
  