* @author N Kuropatkin
*
*/
public class BitManipulationTest extends TestCase {
public void testBitManipulation() {
BitManipulation bm = new BitManipulation();
long mag1 = BitManipulation.magic2;
long a = 3;
long b = bm.swapLSBMSB(a);
assertEquals("swapLSBMSB=" + b, 1, a/b, 1e-10);
a = 8;
b = bm.swapLSBMSB(a);
assertEquals("swapLSBMSB=" + b, 2, a/b, 1e-10);
a = 3;
b = bm.invswapLSBMSB(a);
assertEquals("invswapLSBMSB=" + b, -4, b, 1e-10);
a = 8;
b = bm.invswapLSBMSB(a);
assertEquals("invswapLSBMSB=" + b, -5, b, 1e-10);
a = 3;
b = bm.invMSB(a);
assertEquals("invMSB=" + b, mag1-1, b, 1e-10);
a = 8;
b = bm.invMSB(a);
assertEquals("invMSB=" + b, mag1-8, b, 1e-10);
}