public void TryParseAffinity_16CoreBitmask_ReturnsTrue() { var _inputString = "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31"; long _match = 0xAAAAAAAA; // core1-core31 alternating var _isCoreString = BitmaskExtensions.TryParseAffinity(_inputString, out long _result); var result = _isCoreString && Int64.Equals(_match, _result); Assert.IsTrue(result); }
public void TryParseAffinity_OverflowSanity_ReturnsTrue() { // overflow test var _inputString = "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47"; long _match = 0xAAAAAAAA; // core0-core31 alternating var _isCoreString = BitmaskExtensions.TryParseAffinity(_inputString, out long _result); // should truncate to 32 bits [0-31] var result = _isCoreString && Int64.Equals(_match, _result); Assert.IsTrue(result); }