コード例 #1
0
ファイル: CQLValue.cpp プロジェクト: deleisha/neopegasus
void drive_get_misc_functions()
{

    try {
        // Get function tests
        CQLValue a1(Uint64(123));
        CQLValue a2(Sint64(-123));
        CQLValue a3(Real64(25.24));
        CQLValue a4(String("Hellow"));
        CQLValue a5(Boolean(true));

        String _date("20040811105625.000000-360");
        CIMDateTime date(_date);
        CQLValue a6(date);
        String _date1("20040811105626.000000-360");
        CIMDateTime date1(_date1);
        CQLValue a61(date1);

        String opStr("MyClass.z=true,y=1234,x=\"Hello World\"");
        CIMObjectPath op(opStr);
        CQLValue a7(op);

        const CIMName _cimName(String("CIM_OperatingSystem"));
        CIMInstance _i1(_cimName);

        CQLValue a8(_i1);

        PEGASUS_TEST_ASSERT(a1.getUint() == Uint64(123));
        PEGASUS_TEST_ASSERT(a2.getSint() == Sint64(-123));
        PEGASUS_TEST_ASSERT(a3.getReal() == Real64(25.24));
        PEGASUS_TEST_ASSERT(a4.getString() == String("Hellow"));
        PEGASUS_TEST_ASSERT(a5.getBool() == Boolean(true));
        PEGASUS_TEST_ASSERT(a6.getDateTime() == CIMDateTime(_date));
        PEGASUS_TEST_ASSERT(a6 != a61);
        PEGASUS_TEST_ASSERT(a6 < a61);
        PEGASUS_TEST_ASSERT(a7.getReference() ==
                            CIMObjectPath(opStr));

        try
        {
            a1.getSint();
            PEGASUS_TEST_ASSERT(0);
        }
        catch(...)
        {
            PEGASUS_TEST_ASSERT(1);
        }
    }
    catch(Exception & e)
    {
        cout << e.getMessage() << endl;
        PEGASUS_TEST_ASSERT(0);
    }

    return;
}
コード例 #2
0
void CBCGPPlannerViewMonth::SetDateInterval (const COleDateTime& date1, const COleDateTime& date2)
{
	ASSERT (date1 <= date2);

	COleDateTimeSpan duration (date2 - date1);

	m_nDuration = ((int)(duration.GetTotalDays () / 7.0)) * 7;
	if (m_nDuration < duration.GetTotalDays ())
	{
		m_nDuration += 7;
	}

	if (m_nDuration < 14)
	{
		m_nDuration = 14;
	}
	else if (m_nDuration > 42)
	{
		m_nDuration = 42;
	}

	COleDateTime _date1 (date1);

	if (IsCompressWeekend () &&
		CBCGPPlannerManagerCtrl::GetFirstDayOfWeek () == 0)
	{
		_date1 += COleDateTimeSpan (1, 0, 0, 0);
	}

	m_DateStart = GetFirstWeekDay2 (_date1, CBCGPPlannerManagerCtrl::GetFirstDayOfWeek () + 1);
	m_DateEnd   = m_DateStart + COleDateTimeSpan (m_nDuration - 1, 23, 59, 59);

	if (m_DateEnd < m_Date || m_Date < m_DateStart)
	{
		m_Date = m_DateStart;
	}

	SetDate (m_Date);
}