Example #1
0
/** Save a QPolygon to a stream in a shorter form. */
void ShortSave(QDataStream & s, const QPolygon& a)
{
  //first, check if we _can_ do this the short way...
  QRect bBox = a.boundingRect();

  if (bBox.width() <= 254 && bBox.height() <= 254)
    {
      //qDebug("using  8 bits format");
      //ok, we can do our own saving in 8 bits format to save space
      s << (qint8) 1; //set flag to say we used this format :-)
      QPoint topLeft = bBox.topLeft(); //get the coordinates of the top left of the box
      s << topLeft;
      QPolygon ca(a);
      ca.translate(-topLeft.x(), -topLeft.y()); // translate the box so it's top left on (0,0)
      //now, all points in the array fit into 16 bits!
      s << (quint32) ca.count();

      for (int i = 0; i < ca.count(); i++)
        {
          s << (quint8) ca.at(i).x();
          s << (quint8) ca.at(i).y();
        }
    }
  else if (bBox.width() < 65500 && bBox.height() < 65500)
    {
      //qDebug("using 16 bits format");
      //ok, we can do our own saving in 16 bits format to save space
      s << (qint8) 2; //set flag to say we used this format :-)
      QPoint topLeft = bBox.topLeft(); //get the coordinates of the top left of the box
      s << topLeft;
      QPolygon ca(a);
      ca.translate(-topLeft.x(), -topLeft.y()); // translate the box so it's top left on (0,0)
      //now, all points in the array fit into 32 bits!
      s << (quint32) ca.count();

      for (int i = 0; i < ca.count(); i++)
        {
          s << (quint16) ca.at(i).x();
          s << (quint16) ca.at(i).y();
        }
    }
  else
    {
      //qDebug("using long 32 bits format.");
      //too big. We need to use the normal 2x32 bits format :-(
      s << (qint8) 4; //we need to set a flag that we use the normal format
      s << a;
    }
}
LRESULT C_BranchProperties::OnColour(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	C_STLException::install();

	try {

		if (m_pBranch) {

			C_ColourAreaPtr ca(m_pBranch);

			if (ca) {

				HWND wnd = reinterpret_cast<HWND>(lParam);

				if (wnd == m_btnFill.m_hWnd) {
					
					ca->put_FillColour(wParam);

					if (m_pMap) {
						m_pMap->RedrawAll();
					}
				}
				/*else if (wnd == m_btnOutline.m_hWnd) {
					ca->put_BorderColour(wParam);
				}*/
			}
		}
	}
	catch (C_STLNonStackException const &exception) {
		exception.Log(_T("Exception in C_BranchProperties::"));
	}

	return S_OK;
}
Example #3
0
void MarkerStorage::generateMarkers(PCube fromCube, const Area* fromArea)
{
	Context* context = Context::getContext();
	CPDatabase db = CONST_COMMITABLE_CAST(Database, context->getParent(fromCube));
	PEngineBase engine = context->getServer()->getEngine(EngineBase::CPU, false);

	PCubeArea ca(new CubeArea(db, fromCube, *fromArea));
	PArea area = ca->expandStar(CubeArea::BASE_ELEMENTS);

	//go through string storage
	PSourcePlanNode sn(new SourcePlanNode(fromCube->getStringStorageId(), area, fromCube->getObjectRevision()));
	PProcessorBase cs = engine->createProcessor(sn, true);
	while (cs->next()) {
		addMarker(cs->getKey());
	}
	//go through numeric storage
	sn.reset(new SourcePlanNode(fromCube->getNumericStorageId(), area, fromCube->getObjectRevision()));
	cs = engine->createProcessor(sn, true);
	while (cs->next()) {
		addMarker(cs->getKey());
	}
	//go through marker storage
	sn.reset(new SourcePlanNode(fromCube->getMarkerStorageId(), area, fromCube->getObjectRevision())); // TODO: -jj- right version object?
	cs = engine->createProcessor(sn, true);
	while (cs->next()) {
		addMarker(cs->getKey());
	}

	//go through changedCells
	PCellMapPlanNode cmpn(new CellMapPlanNode(fromCube->getMarkerStorageId(), area));
	cs = engine->createProcessor(cmpn, true);
	while (cs->next()) {
		addMarker(cs->getKey());
	}
}
/* ****************************************************************************
*
* check_json -
*/
TEST(ContextAttributeResponseVector, check_json)
{
    ContextAttributeResponseVector  carV;
    ContextAttribute                ca("caName", "caType", "caValue");
    ContextAttributeResponse        car;
    std::string                     out;
    const char*                     outfile1 = "ngsi10.contextAttributeResponse.check1.valid.json";
    const char*                     outfile2 = "ngsi10.contextAttributeResponse.check2.valid.json";
    ConnectionInfo                  ci(JSON);

    // 1. ok
    car.contextAttributeVector.push_back(&ca);
    carV.push_back(&car);
    out = carV.check(&ci, UpdateContextAttribute, "", "", 0);
    EXPECT_STREQ("OK", out.c_str());

    // 2. Predetected Error
    out = carV.check(&ci, UpdateContextAttribute, "", "PRE ERROR", 0);
    EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
    EXPECT_STREQ(expectedBuf, out.c_str());


    // 3. Bad ContextAttribute
    ContextAttribute  ca2("", "caType", "caValue");

    car.contextAttributeVector.push_back(&ca2);
    out = carV.check(&ci, UpdateContextAttribute, "", "", 0);
    EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'";
    EXPECT_STREQ(expectedBuf, out.c_str());
}
Example #5
0
static void check(const UString& dati_cert, const UString& dati_ca)
{
   U_TRACE(5,"check(%p,%p)", &dati_cert, &dati_ca)

   UCertificate c(dati_cert);
   UCertificate ca(dati_ca);

   UVector<UString> vec1, vec2;
   (void) c.getCAIssuers(vec1);
   (void) c.getRevocationURL(vec2);

   cout << c                        << '\n'
        << c.isSelfSigned()         << '\n'
        << c.isIssued(ca)           << '\n'
        << c.getIssuer()            << '\n' 
   //   << c.getIssuerForLDAP()     << '\n' 
        << c.getSubject()           << '\n'
        << c.getVersionNumber()     << '\n'           
        << c.getSerialNumber()      << '\n' 
        << c.hashCode()             << '\n' 
        << c.getNotBefore()         << '\n' 
        << c.getNotAfter()          << '\n' 
        << c.checkValidity()        << '\n'
        << vec1                     << '\n'
        << vec2                     << '\n';

   UString encoded = c.getEncoded("PEM");

   /*
   UFile::writeTo("certificate.encode", encoded);

   U_ASSERT( dati_cert == encoded )
   */
}
// fuse::read
int AutoHttpFs::read(const char* path, char* buf, size_t size, off_t offset, struct fuse_file_info* ffi)
{
  AutoHttpFsContext* ctx = AUTOHTTPFSCONTEXTS.find(ffi->fh);
  glog(Log::DEBUG, ">> %s(%s) ffi=%p, fh=%"FINT64"d, ctx=%p, size=%"FINT64"d, offset=%"FINT64"d\n", \
                        __FUNCTION__, path, ffi, ffi->fh, ctx, (off_t)size, offset);

  if(ffi->fh==0) return -EINVAL;

  // for proc/.
  if(ctx->proc) return ctx->proc->read(glog, buf, size, offset);

  // for normal files.
  UrlStat us;
  int r = ctx->get_attr(glog, path, us);
  if(r!=0) return r;
  if(!us.is_reg()) return -EINVAL;
 
  if((uint64_t)offset>=us.length) return 0;
  if((uint64_t)offset+(uint64_t)size>=us.length) {
    size = us.length - offset;
  }
  if(size<0) return 0;

  CurlAccessor ca(path);
  r = ca.get(glog, buf, offset, size);
  if((r==200)||(r==206)) return size;

  return -ENOENT;
}
Example #7
0
void tst_Q3CString::constructor()
{
    Q3CString a;
    Q3CString b; //b(10);
    Q3CString c("String C");
    char tmp[10];
    tmp[0] = 'S';
    tmp[1] = 't';
    tmp[2] = 'r';
    tmp[3] = 'i';
    tmp[4] = 'n';
    tmp[5] = 'g';
    tmp[6] = ' ';
    tmp[7] = 'D';
    tmp[8] = 'X';
    tmp[9] = '\0';
    Q3CString d(tmp,9);
    Q3CString ca(a);
    Q3CString cb(b);
    Q3CString cc(c);

    QCOMPARE(a,ca);
    QVERIFY(a.isNull());
    QVERIFY(a == Q3CString(""));
    QCOMPARE(b,cb);
    QCOMPARE(c,cc);
    QCOMPARE(d,(Q3CString)"String D");

    Q3CString null(0);
    QVERIFY( null.isNull() );
    QVERIFY( null.isEmpty() );
    Q3CString empty("");
    QVERIFY( !empty.isNull() );
    QVERIFY( empty.isEmpty() );
}
/* ****************************************************************************
*
* check_json - 
*/
TEST(AppendContextElementResponse, check_json)
{
  AppendContextElementResponse  acer;
  ContextAttributeResponse      car;
  ContextAttribute              ca("", "TYPE", "VALUE"); // empty name, thus provoking error
  std::string                   out;
  const char*                   outfile1 = "ngsi10.appendContextElementRequest.check1.postponed.json";
  const char*                   outfile2 = "ngsi10.appendContextElementRequest.check2.postponed.json";
  ConnectionInfo                ci;

  utInit();

  // 1. predetected error
  ci.outMimeType = JSON;
  out = acer.check(&ci, IndividualContextEntity, "", "PRE ERR", 0);
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  // 2. bad contextAttributeResponseVector
  car.contextAttributeVector.push_back(&ca);
  acer.contextAttributeResponseVector.push_back(&car);
  out = acer.check(&ci, IndividualContextEntity, "", "", 0);
  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'";
  EXPECT_STREQ(expectedBuf, out.c_str());

  // 3. OK
  ca.name = "NAME";
  out = acer.check(&ci, IndividualContextEntity, "", "", 0);
  EXPECT_EQ("OK", out);

  utExit();
}  
int main() {
  ContoCorrente cc(1000);
  cc.preleva(300);
  cc.deposita(700);
  ContoArancio ca(cc, 500);
  ca.preleva(100);
}
Example #10
0
int main(int argc, char *argv[])
{
    if (argc == 2)
    {
        QCoreApplication ca(argc, argv);

        if (ca.arguments().at(1) == "-s")
        {
            LsPaConnection(NULL).printDeviceList();
        }
        return 0;
    }

    QApplication a(argc, argv);

    PaUtilRingBuffer rb;
    char buffer[8 * 1024 * 16];
    ring_buffer_size_t size = PaUtil_InitializeRingBuffer(&rb, 8, 1024 * 16, &buffer[0]);
    Q_UNUSED(size);

    PaUtil_FlushRingBuffer(&rb);

    int ret = -1;

    LsPaConnection connection(&rb);

    Control control;

    control.setPortAudioRec(&connection);

    if (a.arguments().count() > 2)
    {
        bool ok = false;
        int nr = a.arguments().at(1).toInt(&ok);
        QString deviceName;
        if ( ! ok )
        {
            deviceName = "Line 3/4 (M-Audio Delta 1010LT)[Windows WASAPI]";
        }
        else
        {
            deviceName = connection.getDeviceName(nr);
        }
        if (deviceName != "")
        {
            control.startRecording(deviceName, a.arguments().at(2));
        }

        ret = a.exec();
    }
    else
    {
        ThreatedServerSocket server(&control);
        server.start();

        ret = a.exec();
    }

    return ret;
}
Example #11
0
static void check(const UString& dati_crl, const UString& dati_ca)
{
   U_TRACE(5,"check(%p,%p)", &dati_crl, &dati_ca)

// long revoked[10];
   UCrl c(dati_crl);
   UCertificate ca(dati_ca);

   cout << c                                 << "\n"
        << c.isUpToDate()                    << "\n"
        << c.getIssuer()                     << "\n"
        << c.isIssued(ca)                    << "\n"
        << c.getVersionNumber()              << "\n"
        << c.getLastUpdate()                 << "\n"
   //   << c.getRevokedSerials(revoked, 10)  << "\n"
        << c.getNextUpdate();

   UString encoded = c.getEncoded("PEM");

   /*
   UFile::writeTo("crl.encode", encoded);

   U_ASSERT( dati_crl == encoded )
   */
}
C4Network2ResDlg::ListItem::ListItem(C4Network2ResDlg *pForResDlg, const C4Network2Res *pByRes)
		: pSaveBtn(NULL)
{
	// init by res core (2do)
	iResID = pByRes->getResID();
	const char *szFilename = GetFilename(pByRes->getCore().getFileName());
	// get size
	int iIconSize = ::GraphicsResource.TextFont.GetLineHeight();
	int iWidth = pForResDlg->GetItemWidth();
	int iVerticalIndent = 2;
	SetBounds(C4Rect(0, 0, iWidth, iIconSize+2*iVerticalIndent));
	C4GUI::ComponentAligner ca(GetContainedClientRect(), 0,iVerticalIndent);
	// create subcomponents
	pFileIcon = new C4GUI::Icon(ca.GetFromLeft(iIconSize), C4GUI::Ico_Resource);
	pLabel = new C4GUI::Label(szFilename, iIconSize + IconLabelSpacing,iVerticalIndent, ALeft);
	pProgress = NULL;
	// add components
	AddElement(pFileIcon); AddElement(pLabel);
	// tooltip
	SetToolTip(LoadResStr("IDS_DESC_RESOURCE"));
	// add to listbox (will eventually get moved)
	pForResDlg->AddElement(this);
	// first-time update
	Update(pByRes);
}
C4GameOptionsList::OptionDropdown::OptionDropdown(class C4GameOptionsList *pForDlg, const char *szCaption, bool fReadOnly)
		: Option(pForDlg)
{
	CStdFont &rUseFont = ::GraphicsResource.TextFont;
	// get size of caption label
	bool fTabular = pForDlg->IsTabular();
	int32_t iCaptWidth, iCaptHeight;
	if (fTabular)
	{
		// tabular layout: Caption label width by largest caption
		rUseFont.GetTextExtent(LoadResStr("IDS_NET_RUNTIMEJOIN"), iCaptWidth, iCaptHeight, true);
		iCaptWidth = iCaptWidth * 5 / 4;
	}
	else
	{
		rUseFont.GetTextExtent(szCaption, iCaptWidth, iCaptHeight, true);
	}
	// calc total height for component
	int iHorizontalMargin = 1;
	int iVerticalMargin = 1;
	int iComboMargin = 5;
	int iSelComboHgt = C4GUI::ComboBox::GetDefaultHeight();
	SetBounds(C4Rect(0, 0, pForDlg->GetItemWidth(), (!fTabular) * (iCaptHeight + iVerticalMargin*2) + iVerticalMargin*2 + iSelComboHgt));
	C4GUI::ComponentAligner ca(GetContainedClientRect(), iHorizontalMargin, iVerticalMargin);
	// create subcomponents
	AddElement(pCaption = new C4GUI::Label(FormatString("%s:", szCaption).getData(), fTabular ? ca.GetFromLeft(iCaptWidth, iCaptHeight) : ca.GetFromTop(iCaptHeight), ALeft));
	ca.ExpandLeft(-iComboMargin);
	AddElement(pPrimarySubcomponent = pDropdownList = new C4GUI::ComboBox(ca.GetAll()));
	pDropdownList->SetReadOnly(fReadOnly);
	pDropdownList->SetComboCB(new C4GUI::ComboBox_FillCallback<C4GameOptionsList::OptionDropdown>(this, &C4GameOptionsList::OptionDropdown::OnDropdownFill, &C4GameOptionsList::OptionDropdown::OnDropdownSelChange));
	// final init
	InitOption(pForDlg);
}
Example #14
0
//頂点abcで作られたポリゴンから法線を計算
Vector3<float> ShadowScene::createPolygonNormal(Vector3<float> a, Vector3<float> b, Vector3<float> c) {
	Vector3<float> ab( b - a );
	Vector3<float> ca( c - a );
	Vector3<float> normal = ab.cross(ca);	//ab bcの外積
	normal.normalize();//単位ベクトルにする

	return normal;
}
Example #15
0
C4Network2ClientListBox::ClientListItem::ClientListItem(class C4Network2ClientListBox *pForDlg, int iClientID) // ctor
		: ListItem(pForDlg, iClientID), pStatusIcon(nullptr), pName(nullptr), pPing(nullptr), pActivateBtn(nullptr), pKickBtn(nullptr), last_sound_time(0)
{
	// get associated client
	const C4Client *pClient = GetClient();
	// get size
	int iIconSize = ::GraphicsResource.TextFont.GetLineHeight();
	if (pForDlg->IsStartup()) iIconSize *= 2;
	int iWidth = pForDlg->GetItemWidth();
	int iVerticalIndent = 2;
	SetBounds(C4Rect(0, 0, iWidth, iIconSize+2*iVerticalIndent));
	C4GUI::ComponentAligner ca(GetContainedClientRect(), 0,iVerticalIndent);
	// create subcomponents
	bool fIsHost = pClient && pClient->isHost();
	pStatusIcon = new C4GUI::Icon(ca.GetFromLeft(iIconSize), fIsHost ? C4GUI::Ico_Host : C4GUI::Ico_Client);
	StdStrBuf sNameLabel;
	if (pClient)
	{
		if (pForDlg->IsStartup())
			sNameLabel.Ref(pClient->getName());
		else
			sNameLabel.Format("%s:%s", pClient->getName(), pClient->getNick());
	}
	else
	{
		sNameLabel.Ref("???");
	}
	pName = new C4GUI::Label(sNameLabel.getData(), iIconSize + IconLabelSpacing,iVerticalIndent, ALeft);
	int iPingRightPos = GetBounds().Wdt - IconLabelSpacing;
	if (::Network.isHost()) iPingRightPos -= 48;
	if (::Network.isHost() && pClient && !pClient->isHost())
	{
		// activate/deactivate and kick btns for clients at host
		if (!pForDlg->IsStartup())
		{
			pActivateBtn = new C4GUI::CallbackButtonEx<C4Network2ClientListBox::ClientListItem, C4GUI::IconButton>(C4GUI::Ico_Active, GetToprightCornerRect(std::max(iIconSize, 16),std::max(iIconSize, 16),2,1,1), 0, this, &ClientListItem::OnButtonActivate);
			fShownActive = true;
		}
		pKickBtn = new  C4GUI::CallbackButtonEx<C4Network2ClientListBox::ClientListItem, C4GUI::IconButton>(C4GUI::Ico_Kick, GetToprightCornerRect(std::max(iIconSize, 16),std::max(iIconSize, 16),2,1,0), 0, this, &ClientListItem::OnButtonKick);
		pKickBtn->SetToolTip(LoadResStrNoAmp("IDS_NET_KICKCLIENT"));
	}
	if (!pForDlg->IsStartup()) if (pClient && !pClient->isLocal())
		{
			// wait time
			pPing = new C4GUI::Label("???", iPingRightPos, iVerticalIndent, ARight);
			pPing->SetToolTip(LoadResStr("IDS_DESC_CONTROLWAITTIME"));
		}
	// add components
	AddElement(pStatusIcon); AddElement(pName);
	if (pPing) AddElement(pPing);
	if (pActivateBtn) AddElement(pActivateBtn);
	if (pKickBtn) AddElement(pKickBtn);
	// add to listbox (will eventually get moved)
	pForDlg->AddElement(this);
	// first-time update
	Update();
}
Example #16
0
Bst& 
MeChart::
recordedBP(Item* itm, FullHist* h)
{
  int subfv[MAXNUMFS];
  getHt(h, subfv, TCALC);
  CntxArray ca(subfv);
  return itm->stored(ca); 
}
Example #17
0
int main()  
{  
	int c = 3;
	CA ca(1, 2, c);
	ca.show();

	getchar();

	return 0;
} 
Example #18
0
File: cg.c Project: zeotrope/j7-src
static DF1(insert){PROLOG;A hs,*hv,z;I hn,j,k,m,n;
 RZ(w);
 m=IC(w); hs=VAV(self)->h; hn=AN(hs); hv=AAV(hs);
 if(!m)R df1(w,iden(*hv));
 j=n=MAX(hn,m-1);
 RZ(z=AR(w)?from(sc(n%m),w):ca(w));
 if(1==n)R z;
 DO(n, --j; k=j%hn; RZ(z=(VAV(hv[k])->f2)(from(sc(j%m),w),z,hv[k])));
 EPILOG(z);
}
Example #19
0
void WidgetThemeManager::applyCustomThemeOrAppearance(ThemedWidgetStateGeometry* geo, cefix::PropertyList* pl, const std::string subkey)
{
	WidgetTheme* theme = getThemeFromPropertyList(pl);	
					
	if (pl->hasKey("customAppearance")) {
		std::string ca(pl->get("customAppearance")->asString());
		if (theme->hasDescription(ca)) 
			theme->updateStateGeometry(geo, ca + subkey );
	}
}
Example #20
0
void putc(char c, unsigned int col, unsigned int row) {
    // avoid black print bug
    // unsigned char attr = getFormat(C_FG_WHITE, 0, C_BG_BLACK, 0);
    u8 attr = currentFormat;
    if (c == '\n') putc('\r', col, row);

    ca (*p)[VIDEO_COLS] = (ca (*)[VIDEO_COLS]) VIDEO;
    p[row][col].c = c;
    p[row][col].a = attr;

}
int main(int argc, char** argv) {
    typedef BW::CompressedArray<3, float> CA;
    typedef CA::V V;
    
    vigra::MultiArray<3,float> theData(V(100,200,300));
    FillRandom<float, typename vigra::MultiArray<3,float>::iterator>::fillRandom(theData.begin(), theData.end());
   
    CALLGRIND_START_INSTRUMENTATION;
    CA ca(theData);
    CALLGRIND_STOP_INSTRUMENTATION;
}
/* ****************************************************************************
*
* present - just exercise the code
*/
TEST(ContextAttributeResponseVector, present)
{
    ContextAttributeResponseVector  carV;
    ContextAttribute                ca("caName", "caType", "caValue");
    ContextAttributeResponse        car;

    car.contextAttributeVector.push_back(&ca);
    carV.push_back(&car);

    carV.present("");
}
/* ****************************************************************************
*
* check_json - 
*/
TEST(AppendContextElementRequest, check_json)
{
   AppendContextElementRequest  acer;
   std::string                  out;
   ContextAttribute             ca("caName", "caType", "121");
   Metadata                     md("mdName", "mdType", "122");
   const char*                  outfile1 = "ngsi10.appendContextElementResponse.predetectedError.valid.json";
   const char*                  outfile2 = "ngsi10.appendContextElementResponse.missingAttributeName.valid.json";
   const char*                  outfile3 = "ngsi10.appendContextElementResponse.missingMetadataName.valid.json";
   ConnectionInfo               ci;

   utInit();

   acer.attributeDomainName.set("ADN");
   acer.contextAttributeVector.push_back(&ca);
   acer.domainMetadataVector.push_back(&md);

   // 1. ok
   ci.outMimeType = JSON;
   out = acer.check(&ci, AppendContextElement, "", "", 0);
   EXPECT_STREQ("OK", out.c_str());


   // 2. Predetected error 
   EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
   out = acer.check(&ci, AppendContextElement, "", "Error is predetected", 0);
   EXPECT_STREQ(expectedBuf, out.c_str());
   

   // 3. bad ContextAttribute
   ContextAttribute  ca2("", "caType", "121");

   acer.contextAttributeVector.push_back(&ca2);
   out = acer.check(&ci, AppendContextElement, "", "", 0);
   EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'";   
   EXPECT_STREQ(expectedBuf, out.c_str());
   ca2.name = "ca2Name";


   // 4. Bad domainMetadata
   Metadata  md2("", "mdType", "122");

   acer.domainMetadataVector.push_back(&md2);
   out = acer.check(&ci, AppendContextElement, "", "", 0);
   EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile3)) << "Error getting test data from '" << outfile3 << "'";   
   EXPECT_STREQ(expectedBuf, out.c_str());


   // 5. Bad attributeDomainName
   // FIXME P3: AttributeDomainName::check always returns "OK"

   utExit();
}
Example #24
0
NT2_TEST_CASE_TPL ( cauks,  NT2_REAL_TYPES)
{
  T med = 0;
  T scal = 1;
  nt2::table<T> a = nt2::sort(normrnd(med, scal, nt2::of_size(1, 1000)), 2);
  cau_cdf<T>  ca(med, scal);
  T d, p;
  nt2:: kstest(a, ca, d, p);

  // Kolmogorov smirnov at 5% must fail
  NT2_TEST_LESSER_EQUAL(p, 0.05);
}
Example #25
0
  NT2_TEST_CASE_TPL ( normks,  NT2_REAL_TYPES)
{

  T mu = 0;
  T sig = 1;
  nt2::table<T> a = nt2::sort(ref<T>::nd(), 2);
  norm_cdf<T>  ca(mu, sig);
  T d, p;
  nt2:: kstest(a, ca, d, p);
  //Kolmogorov smirnov at 5% must succeed
  NT2_TEST_GREATER_EQUAL(p, 0.05);
}
Example #26
0
int main( int hola, char** file_name)
{ 
  /* Defintion de la calibration et visualisation des images 
     patrons et mesures 
  */
  erCalibration ca( "calibration_source.jpg", "calibration_target.bmp", 3, 3);
  erImage pat = ca.get_patron();
  //erShowImage("patron", &pat);
  erImage mes = ca.get_mesure();
  //erShowImage("mesure",&mes);
  
  return(0);
}
/* ****************************************************************************
*
* present - just exercise the code
*/
TEST(AppendContextElementRequest, present)
{
   AppendContextElementRequest  acer;
   std::string                  out;
   ContextAttribute             ca("caName", "caType", "121");
   Metadata                     md("mdName", "mdType", "122");

   acer.attributeDomainName.set("ADN");
   acer.contextAttributeVector.push_back(&ca);
   acer.domainMetadataVector.push_back(&md);

   acer.present("");
}
Example #28
0
// http://blog.csdn.net/cyg0810/article/details/7765894
int mgcurv::crossTwoCircles(Point2d& pt1, Point2d& pt2,
                            const Point2d& c1, float r1, const Point2d& c2, float r2)
{
    point_t p1, p2;
    point_t ca(c1.x, c1.y);
    point_t cb(c2.x, c2.y);
    int n = _crossTwoCircles(p1, p2, ca, r1, cb, r2);
    
    pt1.set((float)p1.x, (float)p1.y);
    pt2.set((float)p2.x, (float)p2.y);
    
    return n;
}
/* ****************************************************************************
*
* present - just exercise the code
*/
TEST(ContextAttributeResponse, present)
{
  ContextAttribute          ca("caName", "caType", "caValue");
  ContextAttributeResponse  car;

  utInit();

  car.contextAttributeVector.push_back(&ca);
  car.statusCode.fill(SccOk);

  car.present("");

  utExit();
}
Example #30
0
File: sched.c Project: somodi/tp3
void proximo_tarea_reloj() {
	ca (*p)[80] = (ca (*)[80]) VIDEO; // magia
	int current = ((int)rtr()/8)-GDT_TASK1;
	unsigned char colors[5] = {Ctask1,Ctask2,Ctask3,Ctask4,Ctask5};
	if( 0 <= current && current <= 4 ) {
		p[19+current][0].c = reloj[ relojes[current] ];
		p[19+current][0].a = colors[current] | 0x7;
		relojes[current] = ( relojes[current]+1 ) % 4;
	}
	if( tareas[current] == 0 ) {
		p[19+current][0].c = 'x';
		p[19+current][0].a = 0x70;
	}
}