Ejemplo n.º 1
0
TEST(TNEANet, GetSAttrDatE_str) {
  PNEANet Graph;
  Graph = TNEANet::New();
  Graph->AddNode(0);
  Graph->AddNode(1);
  Graph->AddEdge(0, 1, 0);
  TStr Val;
  TInt AttrId(0);
  TStr AttrName("TestInt");
  TInt EId(0);
  int status = Graph->GetSAttrDatE(EId, AttrName, Val);
  EXPECT_EQ(-1, status);
  status = Graph->GetSAttrDatE(EId, AttrId, Val);
  EXPECT_EQ(-1, status);
  Graph->AddSAttrE(AttrName, atStr, AttrId);
  TStr TestVal("5");
  Graph->AddSAttrDatE(EId, AttrId, TestVal);
  status = Graph->GetSAttrDatE(EId, AttrId, Val);
  EXPECT_EQ(0, status);
  EXPECT_STREQ(TestVal.CStr(), Val.CStr());
  status = Graph->GetSAttrDatE(EId, AttrName, Val);
  EXPECT_EQ(0, status);
  EXPECT_STREQ(TestVal.CStr(), Val.CStr());
  TInt ErrorId(1);
  status = Graph->GetSAttrDatE(ErrorId, AttrId, Val);
  EXPECT_EQ(-1, status);
}
Ejemplo n.º 2
0
TEST(TNEANet, GetSAttrDatE_flt) {
  PNEANet Graph;
  Graph = TNEANet::New();
  Graph->AddNode(0);
  Graph->AddNode(1);
  Graph->AddEdge(0, 1, 0);
  TFlt Val;
  TInt AttrId(0);
  TStr AttrName("TestInt");
  TInt EId(0);
  int status = Graph->GetSAttrDatE(EId, AttrName, Val);
  EXPECT_EQ(-1, status);
  status = Graph->GetSAttrDatE(EId, AttrId, Val);
  EXPECT_EQ(-1, status);
  Graph->AddSAttrE(AttrName, atFlt, AttrId);
  TFlt TestVal(5.0);
  Graph->AddSAttrDatE(EId, AttrId, TestVal);
  status = Graph->GetSAttrDatE(EId, AttrId, Val);
  EXPECT_EQ(0, status);
  EXPECT_EQ(TestVal.Val, Val.Val);
  status = Graph->GetSAttrDatE(EId, AttrName, Val);
  EXPECT_EQ(0, status);
  EXPECT_EQ(TestVal.Val, Val.Val);
  TInt ErrorId(1);
  status = Graph->GetSAttrDatE(ErrorId, AttrId, Val);
  EXPECT_EQ(-1, status);
}