-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release highlights: - Fix for byte length calculation of bits - Fix for Boolean.ClearBit - Added Boolean.ClearBit and .SetBit by reference
- Loading branch information
Showing
4 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Boolean = S7.Net.Types.Boolean; | ||
|
||
namespace S7.Net.UnitTest.TypeTests | ||
{ | ||
[TestClass] | ||
public class BooleanTests | ||
{ | ||
[DataTestMethod] | ||
[DataRow(0)] | ||
[DataRow(1)] | ||
[DataRow(2)] | ||
[DataRow(3)] | ||
[DataRow(4)] | ||
[DataRow(5)] | ||
[DataRow(6)] | ||
[DataRow(7)] | ||
public void TestValidSetBitValues(int index) | ||
{ | ||
Assert.AreEqual(Math.Pow(2, index), Boolean.SetBit(0, index)); | ||
} | ||
|
||
[DataTestMethod] | ||
[DataRow(0)] | ||
[DataRow(1)] | ||
[DataRow(2)] | ||
[DataRow(3)] | ||
[DataRow(4)] | ||
[DataRow(5)] | ||
[DataRow(6)] | ||
[DataRow(7)] | ||
public void TestValidClearBitValues(int index) | ||
{ | ||
Assert.AreEqual((byte) ((uint) Math.Pow(2, index) ^ uint.MaxValue), Boolean.ClearBit(byte.MaxValue, index)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters