Skip to content

Сhanges in class Attribute.#64

Merged
madf merged 31 commits intomadf:mainfrom
HelenMamontova:initial
Jan 14, 2026
Merged

Сhanges in class Attribute.#64
madf merged 31 commits intomadf:mainfrom
HelenMamontova:initial

Conversation

@HelenMamontova
Copy link
Collaborator

The make function added to class Attribute.

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 0% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.77%. Comparing base (0032fcb) to head (0826ceb).

Files with missing lines Patch % Lines
src/attribute.cpp 0.00% 33 Missing and 1 partial ⚠️
src/error.cpp 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
- Coverage   30.35%   29.77%   -0.58%     
==========================================
  Files          20       20              
  Lines        1960     1998      +38     
  Branches     1422     1445      +23     
==========================================
  Hits          595      595              
- Misses        106      157      +51     
+ Partials     1259     1246      -13     
Flag Coverage Δ
Linux 29.77% <0.00%> (-0.58%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

valueType = ValueType::Encrypted;
else if (type == "octet")
valueType = ValueType::Bytes;
else if (type == "vsa")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can skip this check because you have identical exceptions here and in the else branch.

for (const auto& t : tok)
bytes.push_back(std::stoul(t));
return new Bytes(code, bytes);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no default variant. What will happen if the type is ChapPassword or VendorSpecific?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or if the type is neither of the enum values?

suchAttributeCodeAlreadyExists,
suchAttributeNameWithAnotherTypeAlreadyExists
suchAttributeNameWithAnotherTypeAlreadyExists,
typeIsNotSupported
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you use this value?

invalidAttributeCode,
invalidAttributeSize,
invalidAttributeType,
invalidValueTypeMember,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this error mean?

using Attribute = RadProto::Attribute;
using ValueType = RadProto::Attribute::ValueType;

ValueType parseValueType(const std::string& type)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the declaration of this function? If it is local - move it to the anonymous namespace. If it is public - put a declaration in the header.

virtual std::vector<uint8_t> toVector(const std::string& secret, const std::array<uint8_t, 16>& auth) const = 0;
virtual Attribute* clone() const = 0;

enum class ValueType : uint8_t
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this type is used in public interfaces. If it is only used internally - move it to the cpp-file.

else if (type == "vsa")
throw RadProto::Exception(RadProto::Error::typeIsNotSupported);
else
throw RadProto::Exception(RadProto::Error::invalidAttributeType);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, the wording here should be invalidValueType, right?

@madf
Copy link
Owner

madf commented Dec 25, 2025

It would be nice to have tests for new function.

@madf madf merged commit e2ee268 into madf:main Jan 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants