问题:字节比较,结果荒唐
代码说话:
procedure TestGeneric.TestByteNot1;
var
C1,C2: Byte;
begin
C1 := $F0; //Random(255)+1;
C2 := not C1;
CheckEquals($F0, C1);
CheckEquals($0F, C2);
CheckEquals(C2, not C1, '恐怕做梦都没想到这个也会失败');
end;
procedure TestGeneric.TestByteNot2;
var
C1,C2: Byte;
begin
C1 := $F0; //Random(255)+1;
C2 := not C1;
Check(C2 = not C1, '恐怕做梦都没想到这个也会失败');
end;
procedure TestGeneric.TestByteNot3;
var
C1,C2,C3: Byte;
begin
C1 := $F0; //Random(255)+1;
C2 := not C1;
C3 := not C2;
CheckEquals(C2, C3); //通过
end;
运行了N年的代码
if C2 = not C1 then
....
而今出错了,害老汉我找了很久才发现问题在这里,有限的生命又浪费些许