예제 #1
0
    bool call(Deserializer* args, Serializer*) const {
        typename StripConstRef<P1>::Type p1;
        typename StripConstRef<P2>::Type p2;
        typename StripConstRef<P3>::Type p3;
        typename StripConstRef<P4>::Type p4;
        typename StripConstRef<P5>::Type p5;
        typename StripConstRef<P6>::Type p6;
        typename StripConstRef<P7>::Type p7;
        typename StripConstRef<P8>::Type p8;
        typename StripConstRef<P9>::Type p9;

        const bool success =
            args->read(&p1) &&
            args->read(&p2) &&
            args->read(&p3) &&
            args->read(&p4) &&
            args->read(&p5) &&
            args->read(&p6) &&
            args->read(&p7) &&
            args->read(&p8) &&
            args->read(&p9);

        if (success) {
            m_function(p1, p2, p3, p4, p5, p6, p7, p8, p9);
        }

        return success;
    }
예제 #2
0
void Task::Run()
{
  m_function();
#ifndef NDEBUG
  std::cout << "TaskRunner: " << m_location.ToString() << std::endl;
#endif
}
예제 #3
0
void CMdFpFlagTest::Run()
{
	//Some documentation about the flags:
	//IsNegative -> Set when value's sign bit is set (regardless of value)
	//IsZero     -> Set when value is either +0 or -0

	CONTEXT ALIGN16 context;
	memset(&context, 0, sizeof(CONTEXT));
	
	context.src0[0] =  0.123412f;
	context.src0[1] = -0.2324f;
	context.src0[2] =  0.f;
	context.src0[3] = -0.f;

	context.src1[0] = 60.f;
	context.src1[1] = 600.f;
	context.src1[2] = -60.f;
	context.src1[3] = 6.f;

	context.src2[0] = -5.5f;
	context.src2[1] = 0;
	context.src2[2] = -7.5f;
	context.src2[3] = -8.5f;

	m_function(&context);

	TEST_VERIFY(context.dstIsNegative0	== 0x5);
	TEST_VERIFY(context.dstIsZero0		== 0x3);

	TEST_VERIFY(context.dstIsNegative1	== 0x2);
	TEST_VERIFY(context.dstIsZero1		== 0x0);

	TEST_VERIFY(context.dstIsNegative2	== 0xB);
	TEST_VERIFY(context.dstIsZero2		== 0x4);
}
예제 #4
0
void CCmp64Test::Run()
{
	memset(&m_context, 0, sizeof(m_context));

	m_context.value0 = m_value0;
	m_context.value1 = m_value1;

	m_function(&m_context);

	uint32 resultEq = (m_value0 == m_value1) ? 1 : 0;
	uint32 resultNe = (m_value0 != m_value1) ? 1 : 0;
	uint32 resultBl = static_cast<uint64>(m_value0) < static_cast<uint64>(m_value1) ? 1 : 0;
	uint32 resultLt = static_cast<int64>(m_value0) < static_cast<int64>(m_value1) ? 1 : 0;
	uint32 resultLe = static_cast<int64>(m_value0) <= static_cast<int64>(m_value1) ? 1 : 0;
	uint32 resultAb = static_cast<uint64>(m_value0) > static_cast<uint64>(m_value1) ? 1 : 0;
	uint32 resultGt = static_cast<int64>(m_value0) > static_cast<int64>(m_value1) ? 1 : 0;

	TEST_VERIFY(m_context.resultEq == resultEq);
	TEST_VERIFY(m_context.resultNe == resultNe);
	TEST_VERIFY(m_context.resultBl == resultBl);
	TEST_VERIFY(m_context.resultLt == resultLt);
	TEST_VERIFY(m_context.resultLe == resultLe);
	TEST_VERIFY(m_context.resultAb == resultAb);
	TEST_VERIFY(m_context.resultGt == resultGt);
}
예제 #5
0
void CMdFpFlagTest::Run()
{
	CONTEXT ALIGN16 context;
	memset(&context, 0, sizeof(CONTEXT));
	
	context.src0[0] =  0.123412f;
	context.src0[1] = -0.2324f;
	context.src0[2] =  0.f;
	context.src0[3] = -0.f;

	context.src1[0] = 60.f;
	context.src1[1] = 600.f;
	context.src1[2] = -60.f;
	context.src1[3] = 6.f;

	context.src2[0] = -5.5f;
	context.src2[1] = 0;
	context.src2[2] = -7.5f;
	context.src2[3] = -8.5f;

	m_function(&context);

	TEST_VERIFY(context.dstIsNegative0	== 0x4);
	TEST_VERIFY(context.dstIsZero0		== 0x3);

	TEST_VERIFY(context.dstIsNegative1	== 0x2);
	TEST_VERIFY(context.dstIsZero1		== 0x0);

	TEST_VERIFY(context.dstIsNegative2	== 0xB);
	TEST_VERIFY(context.dstIsZero2		== 0x4);
}
예제 #6
0
void plugin::HideUI()
{
	m_function( m_key ) ;

	this->hide() ;
	this->deleteLater() ;
}
예제 #7
0
void CAliasTest::Run()
{
	memset(&m_context, 0, sizeof(m_context));
	m_context.value1[0] = CONSTANT_1;
	m_context.value1[1] = CONSTANT_2;

	for(unsigned int i = 0; i < 4; i++)
	{
		m_context.value2[i] = CONSTANT_3;
		m_context.value3[i] = CONSTANT_3;
	}

	m_context.value4[0] = 0x01234567;
	m_context.value4[1] = 0x01234567;
	m_context.value4[2] = 0x01234567;
	m_context.value4[3] = 0x01234567;

	m_function(&m_context);

	TEST_VERIFY(m_context.result != 0);
	TEST_VERIFY(m_context.value4[0] == (CONSTANT_3 * 2));
	TEST_VERIFY(m_context.value4[1] == 0);
	TEST_VERIFY(m_context.value4[2] == 0);
	TEST_VERIFY(m_context.value4[3] == (CONSTANT_3 * 2));
}
예제 #8
0
unsigned int CBasicBlock::Execute()
{
	m_function(&m_context);

	if(m_context.m_State.nDelayedJumpAddr != MIPS_INVALID_PC)
	{
		m_context.m_State.nPC = m_context.m_State.nDelayedJumpAddr;
		m_context.m_State.nDelayedJumpAddr = MIPS_INVALID_PC;
	}
	else
	{
		m_context.m_State.nPC = m_end + 4;
	}

	assert(m_context.m_State.nGPR[0].nV0 == 0);
	assert(m_context.m_State.nGPR[0].nV1 == 0);
	assert(m_context.m_State.nGPR[0].nV2 == 0);
	assert(m_context.m_State.nGPR[0].nV3 == 0);
	assert((m_context.m_State.nPC & 3) == 0);
	assert((m_context.m_State.nGPR[CMIPS::RA].nV0 & 3) == 0);
	assert(m_context.m_State.nCOP2[0].nV0 == 0x00000000);
	assert(m_context.m_State.nCOP2[0].nV1 == 0x00000000);
	assert(m_context.m_State.nCOP2[0].nV2 == 0x00000000);
	assert(m_context.m_State.nCOP2[0].nV3 == 0x3F800000);
	assert(m_context.m_State.nCOP2VI[0] == 0);

	return ((m_end - m_begin) / 4) + 1;
}
예제 #9
0
void IFutureThread::OnRunThread()
{
	m_started = true;
	if(m_function)
	{
		m_function(m_data);
	}
}
예제 #10
0
void CRandomAluTest3::Run()
{
	memset(&m_context, 0, sizeof(CONTEXT));
	m_context.number1 = TEST_NUMBER1;
	m_context.number2 = TEST_NUMBER2;
	m_function(&m_context);
	TEST_VERIFY(m_context.number1 == static_cast<uint32>(TEST_NUMBER1 ^ TEST_NUMBER2));
	TEST_VERIFY(m_context.number2 == m_context.number1);
}
예제 #11
0
void FfiFunction::evaluate(Context *context, std::vector<Object *> &stack, unsigned count)
{
    bool too_few = (int)count < m_arity.min;
    if (too_few || (m_arity.max != -1 && (int)count > m_arity.max))
        _wrong_arg_count(m_arity, count, m_name);
    Object *result = m_function((Object **)((&stack.back() + 1) - count), count);
    stack.resize(stack.size() - (count - 1));
	stack[stack.size() - 1] = result;
}
예제 #12
0
void CFpIntMixTest::Run()
{
	memset(&m_context, 0, sizeof(CONTEXT));
	m_context.multiplier = 2;
	m_function(&m_context);
	TEST_VERIFY(m_context.multiplier							==    2);
	TEST_VERIFY(*reinterpret_cast<uint32*>(&m_context.number1)	==  200);
	TEST_VERIFY(m_context.number2								== 2.0f);
	TEST_VERIFY(m_context.result								==  200);
}
예제 #13
0
    bool call(Deserializer* args, Serializer* ret) const {
        typename StripConstRef<P1>::Type p1;

        const bool success = args->read(&p1);
        if (success) {
            ret->write(m_function(p1));
        }

        return success;
    }
예제 #14
0
void RuntimeHookFunction::Run(const char* key)
{
	for (auto func = g_runtimeHookFunctions; func; func = func->m_next)
	{
		if (func->m_key == key)
		{
			func->m_function();
		}
	}
}
예제 #15
0
 Lua::LuaRef Invoke(Arguments... arguments)
 {
     if(m_function.state() != nullptr && m_function.isFunction())
     {
         if(m_instance.state() != nullptr && m_instance.isTable())
         {
             // Call as a method.
             return m_function(m_instance, arguments...);
         }
         else
         {
             // Call as a function.
             return m_function(arguments...);
         }
     }
     else
     {
         return Lua::LuaRef();
     }
 }
void openvolume::tableEntryDoubleClicked( QTableWidgetItem * item )
{
	auto tw = m_ui->tableWidget ;

	if( m_diableNonLUKS ){

		if( !tw->item( item->row(),3 )->text().startsWith( "crypto_LUKS" ) ){

			DialogMsg m( this ) ;

			return m.ShowUIOK( tr( "ERROR" ),tr( "Only crypto_LUKS volumes can be selected" ) ) ;
		}else{
			m_ui->pbUUID->setFlat( true ) ;
		}
	}

	if( m_option == openvolume::nonSystemVolumes ) {

		if( !( utility::userIsRoot() || utility::userBelongsToGroup( "zulucrypt" ) ) ){

			if( item->font().italic() != this->font().italic() ){

				DialogMsg m( this ) ;

				auto e = tr( "Insufficient privileges to operate on a system volume.\nRestart zuluCrypt from root's account to proceed" ) ;

				return m.ShowUIOK( tr( "ERROR" ),e ) ;
			}
		}
	}

	if( m_ui->pbUUID->isFlat() ){

		m_function( "UUID=\"" + tw->item( item->row(),4 )->text() + "\"" ) ;
	}else{
		m_function( tw->item( item->row(),0 )->text() ) ;
	}

	this->HideUI() ;
}
예제 #17
0
    bool fired()
    {
        if (!isActive())
            return false;

        m_function();

        if (!m_isRepeating)
            return false;

        updateReadyTime();
        return isActive();
    }
예제 #18
0
    bool call(Deserializer* args, Serializer*) const {
        typename StripConstRef<P1>::Type p1;
        typename StripConstRef<P2>::Type p2;

        const bool success =
            args->read(&p1) &&
            args->read(&p2);

        if (success) {
            m_function(p1, p2);
        }

        return success;
    }
예제 #19
0
    bool call(Deserializer* args, Serializer* ret) const {
        typename StripConstRef<P1>::Type p1;
        typename StripConstRef<P2>::Type p2;
        typename StripConstRef<P3>::Type p3;

        const bool success =
            args->read(&p1) &&
            args->read(&p2) &&
            args->read(&p3);

        if (success) {
            ret->write(m_function(p1, p2, p3));
        }

        return success;
    }
예제 #20
0
void CMemAccessTest::Run()
{
	memset(&m_context, 0, sizeof(m_context));
	memset(&m_memory, 0x80, sizeof(m_memory));

	m_context.offset = 0x4;
	m_context.memory = m_memory;
	m_context.array0[ARRAY_IDX_1] = CONSTANT_1;

	m_function(&m_context);

	TEST_VERIFY(m_memory[1] == CONSTANT_1);
	TEST_VERIFY(m_context.result0 == 0x80808080);
	TEST_VERIFY(m_context.result1 == CONSTANT_1);
	TEST_VERIFY(m_context.array0[ARRAY_IDX_0] == CONSTANT_2);
}
예제 #21
0
TEST(test_program, trigger_errors)
{
    std::istringstream test_in;
    std::ostringstream test_out;
    skipper::program p("dummy help text", test_in, test_out);
    p.set_print_help(false);
    p.set_ready_indicator("");

    stub::call<void(int)> m_function;
    std::function<void(int)> function = [&](int value) {m_function(value);};
    p.add_command<int>("a", "help", function, skipper::range<int>(0, 10));

    test_in.str("wrong key\n a\n wrong input\n q\n");

    p.run();
    EXPECT_NE("", test_out.str());
}
예제 #22
0
TEST(test_program, int_set_command)
{
    std::istringstream test_in;
    std::ostringstream test_out;
    skipper::program p("dummy help text", test_in, test_out);
    p.set_print_help(false);
    p.set_ready_indicator("");

    stub::call<void(int)> m_function;
    std::function<void(int)> function = [&](int value) {m_function(value);};
    p.add_command<int>("a", "help", function, skipper::set<int>({0,7,42,1}));

    test_in.str("a\n 42\n a\n -10\n a\n 0\n a\n 7 a\n 11\n");
    p.run();
    EXPECT_EQ(3U, m_function.calls());
    EXPECT_TRUE(m_function.expect_calls().with(42).with(0).with(7).to_bool());
}
예제 #23
0
void CSimpleMdTest::Run()
{
	memset(&m_context, 0, sizeof(m_context));

	for(unsigned int i = 0; i < 4; i++)
	{
		m_context.op1[i] = i * 0x10000;
		m_context.op2[i] = i;
	}

	m_function(&m_context);

	for(unsigned int i = 0; i < 4; i++)
	{
		TEST_VERIFY(m_context.result[i] == m_context.op1[i] + m_context.op2[i]);
	}
}
예제 #24
0
TaskResult TaskManager::Task::Think()
{
	if (gpGlobals->time >= m_gametime)
	{
		m_function(m_edict);
		
		if (m_flags & TF_INF)
		{
			m_gametime = gpGlobals->time + m_time;
			return TR_Save;
		}
		else
			return TR_Delete;
	}

	return TR_Save;
}
예제 #25
0
TEST(test_program, float_range_command)
{
    std::istringstream test_in;
    std::ostringstream test_out;
    skipper::program p("dummy help text", test_in, test_out);
    p.set_print_help(false);
    p.set_ready_indicator("");

    stub::call<void(float)> m_function;
    std::function<void(float)> function = [&](float value) {m_function(value);};
    p.add_command<float>("a", "help", function,
                         skipper::range<float>(-4.0F, 7.2F));

    test_in.str("a\n 42\n a\n -1\n a\n 0\n a\n 7\n a\n 11\n");
    p.run();
    EXPECT_EQ(3U, m_function.calls());
    EXPECT_TRUE(m_function.expect_calls().with(-1).with(0).with(7).to_bool());
}
예제 #26
0
void CAlu64Test::Run()
{
	memset(&m_context, 0, sizeof(m_context));

	m_context.value0 = CONSTANT_1;
	m_context.value1 = CONSTANT_2;
	m_context.value2 = CONSTANT_3;
	m_context.value3 = CONSTANT_4;

	m_function(&m_context);

	TEST_VERIFY(m_context.resultAdd0 == (CONSTANT_1 + CONSTANT_2));
	TEST_VERIFY(m_context.resultAdd1 == (CONSTANT_3 + CONSTANT_4));
	TEST_VERIFY(m_context.resultAddCst == (CONSTANT_1 + CONSTANT_5));

	TEST_VERIFY(m_context.resultSub0 == (CONSTANT_1 - CONSTANT_2));
	TEST_VERIFY(m_context.resultSub1 == (CONSTANT_3 - CONSTANT_4));
	TEST_VERIFY(m_context.resultSubCst == (CONSTANT_5 - CONSTANT_1));
}
예제 #27
0
void CMemAccessRefTest::Run()
{
	memset(&m_context, 0, sizeof(m_context));
	for(uint32 i = 0; i < MEMORY_SIZE; i++)
	{
		m_memory[i] = nullptr;
	}
	m_memory[LOAD_IDX] = &m_context.readValue;
	m_context.readValue = CONSTANT_1;

	m_context.memory = m_memory;

	m_function(&m_context);

	TEST_VERIFY(m_context.readValueResult == CONSTANT_1);
	TEST_VERIFY(m_context.nullCheck0 != 0);
	TEST_VERIFY(m_context.nullCheck1 == 0);
	TEST_VERIFY(m_context.nullCheck2 != 0);
	TEST_VERIFY(m_context.nullCheck3 == 0);
}
예제 #28
0
    bool call(Deserializer* args, Serializer*) const {
        typename StripConstRef<P1>::Type p1;
        typename StripConstRef<P2>::Type p2;
        typename StripConstRef<P3>::Type p3;
        typename StripConstRef<P4>::Type p4;
        typename StripConstRef<P5>::Type p5;

        const bool success =
            args->read(&p1) &&
            args->read(&p2) &&
            args->read(&p3) &&
            args->read(&p4) &&
            args->read(&p5);

        if (success) {
            m_function(p1, p2, p3, p4, p5);
        }

        return success;
    }
예제 #29
0
void getKey::run()
{
	QByteArray key = m_function( m_exe,m_keyFile,m_key ) ;

	if( key.isEmpty() ){
		m_status = getKey::wrongKey ;
	}else{
		void * handle = zuluCryptPluginManagerOpenConnection( m_token.toLatin1().constData() ) ;

		if( handle ){

			zuluCryptPluginManagerSendKey( handle,key.constData(),key.size() ) ;
			zuluCryptPluginManagerCloseConnection( handle ) ;

			m_status = getKey::complete ;
		}else{
			m_status = getKey::wrongKey ;
		}
	}
}
예제 #30
0
TEST(test_program, string_any_command)
{
    std::istringstream test_in;
    std::ostringstream test_out;
    skipper::program p("dummy help text", test_in, test_out);
    p.set_print_help(false);
    p.set_ready_indicator("");

    stub::call<void(std::string)> m_function;
    std::function<void(std::string)> function = [&](std::string value)
    {
        m_function(value);
    };
    p.add_command<std::string>("a", "help", function);

    test_in.str("a\n hello\n a\n world\n");
    p.run();
    EXPECT_EQ(2U, m_function.calls());
    EXPECT_TRUE(
        m_function.expect_calls().with("hello").with("world").to_bool());
}