Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogicValue radixString uses underscore separators by default #535

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

desmonddak
Copy link
Contributor

Description & Motivation

Added an option to LogicValue.toRadixString and .ofRadixString to use '_' as a default separator, but allow
for the user to specify a different separator.

Related Issue(s)

#534

Testing

Converted tests to use _ as separator after testing with sepChar argument.

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

Yes. Previously output radixStrings will not parse by default as they will have spaces.

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

Documentation in the class code is now up to date with this change.

Copy link
Contributor

@mkorbel1 mkorbel1 left a comment

Choose a reason for hiding this comment

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

nice changes!

lib/src/values/logic_value.dart Outdated Show resolved Hide resolved
lib/src/values/logic_value.dart Outdated Show resolved Hide resolved
lib/src/values/logic_value.dart Outdated Show resolved Hide resolved
test/logic_value_test.dart Outdated Show resolved Hide resolved
@desmonddak desmonddak requested a review from mkorbel1 December 26, 2024 22:27
@@ -0,0 +1,19 @@
// Copyright (C) 2023 Intel Corporation
Copy link
Contributor

Choose a reason for hiding this comment

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

year :)

@@ -724,6 +727,10 @@ abstract class LogicValue implements Comparable<LogicValue> {
/// radix format. Space-separation is for ease of reading and is often
/// in chunks of 4 digits.
///
/// If the format of then length/radix-encoded string is not completely parsed
/// an exception will be thrown. This can be caused by illegal characters
/// in the string or too short or too long of a value string.
Copy link
Contributor

Choose a reason for hiding this comment

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

what would be an example of too short? wouldn't it 0-pad?

try {
LogicValue.ofRadixString("10'b10 0010_0111");
} on Exception catch (e) {
expect(e.runtimeType, LogicValueConstructionException);
Copy link
Contributor

Choose a reason for hiding this comment

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

i think the typical pattern for this is expect(e, isA<LogicValueConstructionException>())

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.

LogicValue radixStrings should use underscore as separator, similar to Dart 3.6
3 participants