// TODO: TBD: test the other permutations of Binary Bitwise operators involving 2+ arrays... // TODO: TBD: test elastic get/set // TODO: TBD: test the shift left/right issues... // TODO: TBD: test Add/Remove ... also an extension of the shift left/right issue // TODO: TBD: there are two approaches I want to take addressing the shift/elasticity issue... // TODO: TBD: the first is a sort of brute force get/set approach, getting from one source at the source position, setting the destination at the destination position. / that will be a slower performer I think... // TODO: TBD: the second, and better performer, I think, would be to determine the source/destination byte(s), fields, etc, and to shift/merge the bytes from source to destination. this will be by far a better performer, but will also be more complex managing the positions, fields, shifts, etc. probably not as hard as I think it is on the front side of the effort, but it is not something I want to dive into all that casually. /* TODO: TBD: Length/Count should be more intimately connected with an Elasticity behavior, * inelastic behavior should preclude changes; whereas permitting Contraction/Expansion * should respond accordingly, which all told is not really a shift issue, but does comport * with kosher Elasticity behavior... this is coming in a future version, which will also * involve a string separation of Elastic and Inelastic behavior, but not right now. */ private static void VerifyBinaryCalculation(uint x, uint y , CalculateBinaryOperationCallback <uint> expectedOp , CalculateBinaryOperationCallback <ImmutableBitArray> actualOp) { var expected = expectedOp(x, y); var a = CreateBitArray(x); var b = CreateBitArray(y); Assert.NotSame(a, b); var actual = actualOp(a, b); Assert.NotNull(actual); // Demarcation from System.Collections.BitArray. Assert.NotSame(a, actual); Assert.NotSame(b, actual); Assert.Equal(GetEndianAwareBytes(expected), actual.ToBytes(!IsLittleEndian)); }
public void Bitwise_Xor_Binary_calculation_is_correct(uint x, uint y , CalculateBinaryOperationCallback <uint> expectedOp , CalculateBinaryOperationCallback <ImmutableBitArray> actualOp) => VerifyBinaryCalculation(x, y, expectedOp, actualOp);