Skip to content

Commit

Permalink
testing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
xtofalex committed Nov 1, 2024
1 parent c98ff41 commit a2e5db0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/snl/snl/kernel/SNLAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ NajaCollection<SNLAttributes::SNLAttribute> SNLAttributes::getAttributes(const S

void SNLAttributes::cloneAttributes(const SNLObject* from, SNLObject* to) {
auto propFrom = SNLAttributesPrivateProperty::get(from);
auto propTo = SNLAttributesPrivateProperty::getOrCreate(to);
if (propFrom) {
auto propTo = SNLAttributesPrivateProperty::getOrCreate(to);
for (auto attribute: propFrom->getAttributes()) {
propTo->addAttribute(attribute);
}
Expand All @@ -131,7 +131,10 @@ bool SNLAttributes::compareAttributes(
auto prop2 = SNLAttributesPrivateProperty::get(object2);
//xor
if ((prop1 and not prop2) or (not prop1 and prop2)) {
reason = "attributes property mismatch";
std::ostringstream oss;
oss << "attributes property mismatch between ";
oss << object1->getDescription() << " and " << object2->getDescription();
reason = oss.str();
return false;
}
if (prop1 and prop2) {
Expand Down
8 changes: 4 additions & 4 deletions src/snl/snl/kernel/SNLBitTerm.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ class SNLBitTerm: public SNLTerm {
virtual SNLID::Bit getBit() const = 0;
SNLBitNet* getNet() const override { return net_; }
void setNet(SNLNet* net) override;
SNLID::DesignObjectID getOrderID() const { return orederID_; }
void setOrderID(SNLID::DesignObjectID orderID) { orederID_ = orderID; }
SNLID::DesignObjectID getOrderID() const { return orderID_; }
void setOrderID(SNLID::DesignObjectID orderID) { orderID_ = orderID; }
protected:
SNLBitTerm() = default;
static void preCreate();
void postCreate();
void preDestroy() override;
private:
SNLBitNet* net_ { nullptr};
SNLID::DesignObjectID orederID_ = (SNLID::DesignObjectID) -1;
SNLBitNet* net_ { nullptr };
SNLID::DesignObjectID orderID_ { (SNLID::DesignObjectID) -1 };
};

}} // namespace SNL // namespace naja
Expand Down
1 change: 1 addition & 0 deletions test/snl/snl/kernel/SNLInstanceSetModelTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ TEST_F(SNLInstanceSetModelTest, testDifferentParametersSizeError) {
std::string reason;
EXPECT_TRUE(model_->deepCompare(newModel, reason, SNLDesign::CompareType::IgnoreIDAndName));
EXPECT_TRUE(reason.empty());
EXPECT_EQ(std::string(), reason);
EXPECT_TRUE(newModel->isAnonymous());
ASSERT_EQ(3, newModel->getParameters().size());
auto param0 = newModel->getParameter(SNLName("param0"));
Expand Down

0 comments on commit a2e5db0

Please sign in to comment.