public void TestIsNEq() { StrShift hai = new StrShift(); hai = "Microsoft"; Assert.AreEqual(false, hai != "Microsoft", "IsNEq is not correct"); string dummy = hai >> 1; dummy = hai >> 2; Assert.AreEqual(false, hai != "rosoftMic", "IsNEq is not correct"); }
public void TestRotateRight() { StrShift hai = new StrShift(); hai = "Microsoft"; Assert.AreEqual("crosoftMi", hai >> 2, "Right Rotate is not correct"); hai = "haiphan"; string dummy = hai >> 1; dummy = hai >> 1; Assert.AreEqual("iphanha", dummy, "Right Rotate is not correct"); }
public void TestRotateLeft() { StrShift hai = new StrShift(); hai = "Microsoft"; Assert.AreEqual("ftMicroso", hai<<2,"Left Rotate is not correct"); hai = "haiphan"; string dummy = hai << 1; dummy = hai << 1; Assert.AreEqual("anhaiph", dummy, "Left Rotate is not correct"); }
public void TestAssignment() { StrShift hai = new StrShift(); hai = "Microsoft"; string dummy = hai >> 1; dummy = hai << 1; Assert.AreEqual("Microsoft", dummy, "Assign is not correct"); dummy = hai << 3; Assert.AreEqual("oftMicros", dummy, "Assign is not correct"); }
static void Main(string[] args) { StrShift hai = new StrShift(); hai = "Microsoft"; Console.WriteLine("hai>>2 results in "+(hai >> 2)); StrShift hai_b = new StrShift(); hai_b = "crosoftMi"; Console.WriteLine("hai==hai_b:" + (hai == hai_b).ToString()); Console.WriteLine(hai << 1); Console.WriteLine("hai!=hai_b:" + (hai != hai_b).ToString()); Console.WriteLine(hai << 1); }
public bool Equals(StrShift hai) { return (this == hai); }