Example #1
0
	double computeMFLOPS(const dvector_t & tim, const double mflo, Tag::TimeSelect ts )
	{
		linbox_check(tim.size());
		switch (ts) {
		case (Tag::TimeSelect::average) :
			{
				double tps = 0 ;
				for (size_t i = 0 ; i < tim.size() ; ++i)
					tps += tim[i] ;
				return computeMFLOPS(tps,mflo,(size_t)tim.size());
			}
		case (Tag::TimeSelect::bestThree) :
			{
				if (tim.size() <4)
					return computeMFLOPS(tim,mflo,Tag::TimeSelect::average);

				dvector_t tps (3);
				double t1,t2 ;
				if (tim[0]<tim[1]) {
					t1 = tim[0];
					t2 = tim[1];
				}
				else {
					t1 = tim[1];
					t2 = tim[0];
				}
				if (tim[3] < t1) {
					tps[0] = tim[3] ;
					tps[1] = t1 ;
					tps[2] = t2 ;
				}
				else if (tim[2] < t1) {
					tps[0] = t1 ;
					tps[1] = tim[3] ;
					tps[2] = t2 ;
				}
				else {
					tps[0] = t1 ;
					tps[1] = t2;
					tps[2] = tim[3] ;
				}

				for (size_t i = 3 ; i < tim.size() ; ++i)
					insertTime(tps,tim[i]);

				return computeMFLOPS(tim,mflo,Tag::TimeSelect::average);

			}
		case (Tag::TimeSelect::bestOne) :
			{
				double t1 = tim[0] ;
				for (size_t i = 1 ; i < tim.size() ; ++i)
					if (tim[i] < t1)
						t1 = tim[i] ;
				return computeMFLOPS(t1,mflo,1);

			}
		case (Tag::TimeSelect::median) :
			{
				if (tim.size() == 1)
					return computeMFLOPS(tim[0],mflo,1) ;

				dvector_t tps (tim);
				std::sort(tps.begin(),tps.end());
				size_t mid = (size_t)tps.size()/2 ;
				double t1 ;
				if (isOdd((uint64_t)tps.size()))
					t1 = tps[mid] ;
				else
					t1 = (tps[mid-1]+tps[mid])/2;
				return computeMFLOPS(t1,mflo,1);
			}
		case (Tag::TimeSelect::medmean) :
			{
				if (tim.size() < 3)
					return computeMFLOPS(tim,mflo,Tag::TimeSelect::median); ;

				size_t q1 = (size_t)((double)tim.size()/(double)4) ;
				size_t q3 = (size_t)tim.size()-q1 ;
				dvector_t tps (tim);
				std::sort(tps.begin(),tps.end());
				dvector_t tps2 (tim.begin()+q1,tim.begin()+q3);
				return computeMFLOPS(tps2,mflo,Tag::TimeSelect::average);
			}

		default :
			{
				throw("not among tags");
			}

		} // switch(ts)
	}
Example #2
0
void CTTypes::RunTestCaseL(TInt aCurTestCase)
	{
	switch(aCurTestCase)
		{
	case 1:
		{
		__UHEAP_MARK;
		TestRgb tr1(0,0,0, this);
		TestRgb tr2(100,100,100, this);
		TestRgb tr3(10,20,30, this);
		TestRgb tr4(110,160,210, this);
		TestRgb tr5(255,255,255, this);
		INFO_PRINTF1(_L("TRgb"));
		tr1.Test();
		tr2.Test();
		tr3.Test();
		tr4.Test();
		tr5.Test();
		((CTTypesStep*)iStep)->CloseTMSGraphicsStep();
		__UHEAP_MARKEND;
		}
		break;
	case 2:
		{
		INFO_PRINTF1(_L("TTypeface"));
		TestTypeface ttf1(_L(""), 0, this);
		TestTypeface ttf2(_L("Font name"), 1, this);
		TestTypeface ttf3(_L("Font name"), 2, this);
		TestTypeface ttf4(_L("Font name"), 3, this);
		TestTypeface ttf5(_L("Font name"), 4, this);
		TestTypeface ttf6(_L("Font name"), 5, this);
		TestTypeface ttf7(_L("Font name"), 6, this);
		TestTypeface ttf8(_L("Another font name"), 7, this);
		ttf1.Test();
		ttf2.Test();
		ttf3.Test();
		ttf4.Test();
		ttf5.Test();
		ttf6.Test();
		ttf7.Test();
		ttf8.Test();
		}
		break;
	case 3:
		{
		TestMargins tm1(0,0,0,0, this);
		TestMargins tm2(10,20,30,40, this);
		TestMargins tm3(-10,-20,-30,-40, this);
		INFO_PRINTF1(_L("TMargins"));
		tm1.Test();
		tm2.Test();
		tm3.Test();
		}
		break;
	case 4:
		{
		TestPageSpec tps1(TPageSpec::EPortrait,TSize(0,0), this);
		TestPageSpec tps2(TPageSpec::ELandscape,TSize(0,0), this);
		TestPageSpec tps3(TPageSpec::EPortrait,TSize(10,-5), this);
		TestPageSpec tps4(TPageSpec::ELandscape,TSize(15,-20), this);
		TestPageSpec tps5(TPageSpec::EPortrait,TSize(1000,1500), this);
		TestPageSpec tps6(TPageSpec::ELandscape,TSize(2000,500), this);
		INFO_PRINTF1(_L("TPageSpec"));
		tps1.Test();
		tps2.Test();
		tps3.Test();
		tps4.Test();
		tps5.Test();
		tps6.Test();
		}
		break;
	case 5:
		{
		INFO_PRINTF1(_L("FontEffect"));
        	((CTTypesStep*)iStep)->SetTestStepID(_L("GRAPHICS-GDI-0002"));
		TestFontEffect te(this); 
		((CTTypesStep*)iStep)->RecordTestResultL();
		te.Test();
		}
		break;
	case 6:
		{
		INFO_PRINTF1(_L("TFontSyle"));
		TestTFontStyle ts(this);
		ts.Test();
		}
		break;
	case 7:
		{
		TTypeface typeface;
		typeface.iName=_L("Font name");
		TFontStyle fontstyle;
		TestFontSpec tfspec(typeface,200,fontstyle, this);
		INFO_PRINTF1(_L("TFontSpec"));
		tfspec.Test();
		}
		break;
	case 8:
		{
/*
		TestLine tl1(TPoint(10,10),TPoint(90,90), this);
		TestLine tl2(TPoint(100,150),TPoint(50,-50), this);
		TestLine tl3(TPoint(-50,50),TPoint(60,-40), this);
		TestLine tl4(TPoint(-100,0),TPoint(0,200), this);
		TestLine tl5(TPoint(150,-50),TPoint(50,75), this);
		TestLine tl6(TPoint(0,-100),TPoint(-50,-150), this);
		TestLine tl7(TPoint(-1000,-1000),TPoint(1000,1000), this);
		TestLine tl8(TPoint(1000,-1000),TPoint(-1000,1000), this);
		TestLine tl9(TPoint(500,-1000),TPoint(-500,1000), this);
		TestLine tl10(TPoint(-500,-1000),TPoint(500,1000), this);
		TestLine tl11(TPoint(1000,-500),TPoint(-1000,500), this);
		TestLine tl12(TPoint(1000,500),TPoint(-1000,-500), this);
		INFO_PRINTF1(_L("TLinearDDA"));
		tl1.Test();
		tl2.Test();
		tl3.Test();
		tl4.Test();
		tl5.Test();
		tl6.Test();
		tl7.Test();
		tl8.Test();
		tl9.Test();
		tl10.Test();
		tl11.Test();
		tl12.Test();
*/
		INFO_PRINTF1(_L("TLinearDDA is only for Graphics team. Removed."));
		}
		break;
	case 9:
		{
		INFO_PRINTF1(_L("CTypefaceStore"));
		TestTFStore ttfs(this);
		ttfs.Test();
		}
		break;
	case 10:
		{
		INFO_PRINTF1(_L("CFontCache"));
		TestFontCache tfc(this);
		tfc.Test();
		}
		break;
	case 11:
		{
/*
		INFO_PRINTF1(_L("CScaleCropPicture"));
		TestPicture tp(this);
		tp.Test();
*/
		INFO_PRINTF1(_L("CScaleCropPicture is only for Graphics team. Removed."));
		}
		break;
	case 12:
		{
/*
		INFO_PRINTF1(_L("CPalette"));
		TestPalette tpal(this);
		tpal.Test();
*/
		INFO_PRINTF1(_L("CPalette is only for Graphics team. Removed."));
		}
		break;
	case 13:
		{
		INFO_PRINTF1(_L("TDisplayModeUtils"));
		TestDisplayModeUtils tdmu(this);
		tdmu.Test();
		}
		break;
	case 14:
        	((CTTypesStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-GDI-0001"));
		((CTTypesStep*)iStep)->RecordTestResultL();
		((CTTypesStep*)iStep)->CloseTMSGraphicsStep();
		TestComplete();		
		break;
		}
	}