Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Adhara3 committed Mar 24, 2023
1 parent d3a0f72 commit 64e9f99
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions DbcParserLib.Tests/DbcBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace DbcParserLib.Tests
{
[TestFixture]
public class DbcBuilderTests
{
private MockRepository m_repository;
Expand Down Expand Up @@ -104,7 +105,7 @@ public void MessageIsAdded()
Assert.IsEmpty(dbc.Nodes);
Assert.AreEqual(1, dbc.Messages.Count());
Assert.AreEqual(1, dbc.Messages.First().ID);
Assert.AreEqual(false, dbc.Messages.First().IsExtID);
Assert.IsFalse(dbc.Messages.First().IsExtID);
}

[Test]
Expand All @@ -118,7 +119,7 @@ public void ExtendedMessageIsAdded()
Assert.IsEmpty(dbc.Nodes);
Assert.AreEqual(1, dbc.Messages.Count());
Assert.AreEqual(1, dbc.Messages.First().ID);
Assert.AreEqual(true, dbc.Messages.First().IsExtID);
Assert.IsTrue(dbc.Messages.First().IsExtID);
}

[Test]
Expand Down
1 change: 1 addition & 0 deletions DbcParserLib.Tests/EnvironmentVariableLineParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace DbcParserLib.Tests
{
[TestFixture]
public class EnvironmentVariableLineParserTests
{
private MockRepository m_repository;
Expand Down
1 change: 1 addition & 0 deletions DbcParserLib.Tests/ExtensionMethodsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace DbcParserLib.Tests
{
[TestFixture]
public class ExtensionMethodsTests
{
[Test]
Expand Down
6 changes: 4 additions & 2 deletions DbcParserLib/DbcBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ public Dbc Build()
foreach (var message in m_messages)
{
message.Value.Signals.Clear();
message.Value.Signals.AddRange(m_signals[message.Key].Values);
message.Value.IsExtID();
if(m_signals.TryGetValue(message.Key, out var signals) && signals != null)
message.Value.Signals.AddRange(signals.Values);

message.Value.AdjustExtendedId();
}

//TODO: uncomment once Immutable classes are used
Expand Down
2 changes: 1 addition & 1 deletion DbcParserLib/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static bool IsMultiplexed(this Message message)
return message.Signals.Any(s => s.MultiplexingInfo().Role == MultiplexingRole.Multiplexor);
}

internal static void IsExtID(this Message message)
internal static void AdjustExtendedId(this Message message)
{
// For extended ID bit 31 is always 1
if(message.ID >= 0x80000000)
Expand Down

0 comments on commit 64e9f99

Please sign in to comment.