From: mike lowis Date: Fri, 9 Apr 2021 20:13:47 +0000 (-0400) Subject: changed ASSERT to Assert and NEW to New X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=35aff7680cde8d57c7d1c8d066d981f5ddc12f31;p=proto%2Fobnc.git changed ASSERT to Assert and NEW to New --- diff --git a/lib/obnc/FilesTest.obn b/lib/obnc/FilesTest.obn index d0712d5..9b37be0 100644 --- a/lib/obnc/FilesTest.obn +++ b/lib/obnc/FilesTest.obn @@ -23,8 +23,8 @@ module FilesTest; var f: Files.File; begin f := Files.Old("FilesTest.obn"); - ASSERT(f # nil); - ASSERT(f is Files.File) + Assert(f # nil); + Assert(f is Files.File) end TestOld; @@ -32,8 +32,8 @@ module FilesTest; var f: Files.File; begin f := Files.New("NewTest"); - ASSERT(f # nil); - ASSERT(f is Files.File) + Assert(f # nil); + Assert(f is Files.File) end TestNew; @@ -47,28 +47,28 @@ module FilesTest; end IsRider; begin f := Files.New("RegisterTest"); - ASSERT(f # nil); - ASSERT(IsRider(r)); + Assert(f # nil); + Assert(IsRider(r)); Files.Register(f); f := Files.Old("RegisterTest"); - ASSERT(f # nil); + Assert(f # nil); Files.Delete("RegisterTest", res); - ASSERT(res = 0); + Assert(res = 0); f := Files.New("RegisterTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.Write(r, 37); Files.Close(f); Files.Register(f); - ASSERT(Files.Length(f) = 1); + Assert(Files.Length(f) = 1); f := Files.Old("RegisterTest"); - ASSERT(f # nil); - ASSERT(Files.Length(f) = 1); + Assert(f # nil); + Assert(Files.Length(f) = 1); Files.Delete("RegisterTest", res); - ASSERT(res = 0) + Assert(res = 0) end TestRegister; @@ -77,12 +77,12 @@ module FilesTest; r: Files.Rider; begin f := Files.New("CloseTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.Write(r, 65); - ASSERT(Files.Length(f) <= 1); + Assert(Files.Length(f) <= 1); Files.Close(f); - ASSERT(Files.Length(f) = 1) + Assert(Files.Length(f) = 1) end TestClose; @@ -91,11 +91,11 @@ module FilesTest; r: Files.Rider; begin f := Files.New("PurgeTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.Write(r, 65); Files.Purge(f); - ASSERT(Files.Length(f) = 0) + Assert(Files.Length(f) = 0) end TestPurge; @@ -104,14 +104,14 @@ module FilesTest; res: Int; begin f := Files.New("DeleteTest"); - ASSERT(f # nil); + Assert(f # nil); Files.Register(f); f := Files.Old("DeleteTest"); - ASSERT(f # nil); + Assert(f # nil); Files.Delete("DeleteTest", res); - ASSERT(res = 0); + Assert(res = 0); f := Files.Old("DeleteTest"); - ASSERT(f = nil) + Assert(f = nil) end TestDelete; @@ -120,21 +120,21 @@ module FilesTest; res: Int; begin f := Files.New("RenameTest"); - ASSERT(f # nil); + Assert(f # nil); Files.Register(f); f := Files.Old("RenameTest"); - ASSERT(f # nil); + Assert(f # nil); Files.Rename("RenameTest", "RenameTest1", res); - ASSERT(res = 0); + Assert(res = 0); f := Files.Old("RenameTest"); - ASSERT(f = nil); + Assert(f = nil); f := Files.Old("RenameTest1"); - ASSERT(f # nil); + Assert(f # nil); Files.Delete("RenameTest1", res); - ASSERT(res = 0) + Assert(res = 0) end TestRename; @@ -143,11 +143,11 @@ module FilesTest; res: Int; begin f := Files.New("LengthTest"); - ASSERT(f # nil); + Assert(f # nil); Files.Register(f); - ASSERT(Files.Length(f) = 0); + Assert(Files.Length(f) = 0); Files.Delete("LengthTest", res); - ASSERT(res = 0) + Assert(res = 0) end TestLength; @@ -157,25 +157,25 @@ module FilesTest; hour, minute, second, year, month, day: Int; begin f := Files.Old("FilesTest.obn"); - ASSERT(f # nil); + Assert(f # nil); Files.GetDate(f, t, d); hour := t div 4096; - ASSERT(hour >= 0); - ASSERT(hour < 24); + Assert(hour >= 0); + Assert(hour < 24); minute := t div 64 mod 64; - ASSERT(minute >= 0); - ASSERT(minute < 60); + Assert(minute >= 0); + Assert(minute < 60); second := t mod 64; - ASSERT(second >= 0); - ASSERT(second < 60); + Assert(second >= 0); + Assert(second < 60); year := d div 512; - ASSERT(year >= 0); + Assert(year >= 0); month := d div 32 mod 16; - ASSERT(month >= 1); - ASSERT(month <= 12); + Assert(month >= 1); + Assert(month <= 12); day := d mod 32; - ASSERT(day >= 1); - ASSERT(day <= 31) + Assert(day >= 1); + Assert(day <= 31) end TestDate; @@ -184,9 +184,9 @@ module FilesTest; r: Files.Rider; begin f := Files.New("SetTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); - ASSERT(~r.eof) + Assert(~r.eof) end TestSetPos; @@ -195,9 +195,9 @@ module FilesTest; r: Files.Rider; begin f := Files.New("PosTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); - ASSERT(Files.Pos(r) = 0) + Assert(Files.Pos(r) = 0) end TestPos; @@ -206,9 +206,9 @@ module FilesTest; r: Files.Rider; begin f := Files.New("BaseTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); - ASSERT(Files.Base(r) = f) + Assert(Files.Base(r) = f) end TestBase; @@ -218,16 +218,16 @@ module FilesTest; b: Byte; begin f := Files.New("ReadWriteTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.Write(r, 65); Files.Close(f); - ASSERT(Files.Length(f) = 1); + Assert(Files.Length(f) = 1); Files.SetPos(r, f, 0); Files.Read(r, b); - ASSERT(~r.eof); - ASSERT(b = 65); - ASSERT(Files.Pos(r) = 1) + Assert(~r.eof); + Assert(b = 65); + Assert(Files.Pos(r) = 1) end TestReadWrite; @@ -237,7 +237,7 @@ module FilesTest; i: Int; begin f := Files.New("ReadWriteIntTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.WriteInt(r, 100); @@ -246,13 +246,13 @@ module FilesTest; Files.SetPos(r, f, 0); Files.ReadInt(r, i); - ASSERT(~r.eof); - ASSERT(i = 100); + Assert(~r.eof); + Assert(i = 100); Files.ReadInt(r, i); - ASSERT(~r.eof); - ASSERT(i = -1000); + Assert(~r.eof); + Assert(i = -1000); Files.ReadInt(r, i); - ASSERT(r.eof) + Assert(r.eof) end TestReadWriteInt; @@ -262,7 +262,7 @@ module FilesTest; x: Real; begin f := Files.New("ReadWriteRealTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.WriteReal(r, 3.14); @@ -271,13 +271,13 @@ module FilesTest; Files.SetPos(r, f, 0); Files.ReadReal(r, x); - ASSERT(~r.eof); - ASSERT(ABS(x - 3.14) < 1.0E-6); + Assert(~r.eof); + Assert(ABS(x - 3.14) < 1.0E-6); Files.ReadReal(r, x); - ASSERT(~r.eof); - ASSERT(ABS(x - (-3.14)) < 1.0E-6); + Assert(~r.eof); + Assert(ABS(x - (-3.14)) < 1.0E-6); Files.ReadReal(r, x); - ASSERT(r.eof) + Assert(r.eof) end TestReadWriteReal; @@ -287,7 +287,7 @@ module FilesTest; i: Int; begin f := Files.New("ReadWriteNumTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.WriteNum(r, 100); @@ -296,13 +296,13 @@ module FilesTest; Files.SetPos(r, f, 0); Files.ReadNum(r, i); - ASSERT(~r.eof); - ASSERT(i = 100); + Assert(~r.eof); + Assert(i = 100); Files.ReadNum(r, i); - ASSERT(~r.eof); - ASSERT(i = -1000); + Assert(~r.eof); + Assert(i = -1000); Files.ReadNum(r, i); - ASSERT(r.eof) + Assert(r.eof) end TestReadWriteNum; @@ -312,7 +312,7 @@ module FilesTest; s: array 32 of Char; begin f := Files.New("ReadWriteStringTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.WriteString(r, "hello"); @@ -322,16 +322,16 @@ module FilesTest; Files.SetPos(r, f, 0); Files.ReadString(r, s); - ASSERT(~r.eof); - ASSERT(s = "hello"); + Assert(~r.eof); + Assert(s = "hello"); Files.ReadString(r, s); - ASSERT(~r.eof); - ASSERT(s = "there"); + Assert(~r.eof); + Assert(s = "there"); Files.ReadString(r, s); - ASSERT(~r.eof); - ASSERT(s = ""); + Assert(~r.eof); + Assert(s = ""); Files.ReadString(r, s); - ASSERT(r.eof) + Assert(r.eof) end TestReadWriteString; @@ -341,7 +341,7 @@ module FilesTest; s: Set; begin f := Files.New("ReadWriteSetTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.WriteSet(r, {}); @@ -351,16 +351,16 @@ module FilesTest; Files.SetPos(r, f, 0); Files.ReadSet(r, s); - ASSERT(~r.eof); - ASSERT(s = {}); + Assert(~r.eof); + Assert(s = {}); Files.ReadSet(r, s); - ASSERT(~r.eof); - ASSERT(s = {0}); + Assert(~r.eof); + Assert(s = {0}); Files.ReadSet(r, s); - ASSERT(~r.eof); - ASSERT(s = {0, 1}); + Assert(~r.eof); + Assert(s = {0, 1}); Files.ReadSet(r, s); - ASSERT(r.eof) + Assert(r.eof) end TestReadWriteSet; @@ -370,7 +370,7 @@ module FilesTest; b: Bool; begin f := Files.New("ReadWriteBoolTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.WriteBool(r, true); @@ -379,13 +379,13 @@ module FilesTest; Files.SetPos(r, f, 0); Files.ReadBool(r, b); - ASSERT(~r.eof); - ASSERT(b); + Assert(~r.eof); + Assert(b); Files.ReadBool(r, b); - ASSERT(~r.eof); - ASSERT(~b); + Assert(~r.eof); + Assert(~b); Files.ReadBool(r, b); - ASSERT(r.eof) + Assert(r.eof) end TestReadWriteBool; @@ -398,7 +398,7 @@ module FilesTest; for i := 0 to LEN(buf) - 1 do buf[i] := i + 1 end; f := Files.New("ReadWriteBytesTest"); - ASSERT(f # nil); + Assert(f # nil); Files.SetPos(r, f, 0); Files.WriteBytes(r, buf, LEN(buf)); @@ -410,19 +410,19 @@ module FilesTest; Files.SetPos(r, f, 0); Files.ReadBytes(r, buf, LEN(buf)); - ASSERT(~r.eof); + Assert(~r.eof); for i := 0 to LEN(buf) - 1 do - ASSERT(buf[i] = i + 1) + Assert(buf[i] = i + 1) end; Files.ReadBytes(r, buf, LEN(buf)); - ASSERT(~r.eof); + Assert(~r.eof); for i := 0 to LEN(buf) - 1 do - ASSERT(buf[i] = i + 1) + Assert(buf[i] = i + 1) end; Files.ReadBytes(r, buf, LEN(buf)); - ASSERT(r.eof) + Assert(r.eof) end TestReadWriteBytes; begin diff --git a/lib/obnc/InTest.obn b/lib/obnc/InTest.obn index 23581b7..7bca02f 100644 --- a/lib/obnc/InTest.obn +++ b/lib/obnc/InTest.obn @@ -30,51 +30,51 @@ module InTest; begin In.Character(ch); - ASSERT(In.Done); - ASSERT(ch = "a"); + Assert(In.Done); + Assert(ch = "a"); In.Integer(n); - ASSERT(In.Done); - ASSERT(n = 37); + Assert(In.Done); + Assert(n = 37); In.Integer(n); - ASSERT(In.Done); - ASSERT(n = 37H); + Assert(In.Done); + Assert(n = 37H); In.RealNum(x); - ASSERT(In.Done); - ASSERT(x >= 3.14 - eps); - ASSERT(x <= 3.14 + eps); + Assert(In.Done); + Assert(x >= 3.14 - eps); + Assert(x <= 3.14 + eps); In.String(s); - ASSERT(In.Done); - ASSERT(s = ""); + Assert(In.Done); + Assert(s = ""); In.String(s); - ASSERT(In.Done); - ASSERT(s = "foo bar"); + Assert(In.Done); + Assert(s = "foo bar"); In.String(s); - ASSERT(In.Done); - ASSERT(s = 0X); + Assert(In.Done); + Assert(s = 0X); In.String(s); - ASSERT(In.Done); - ASSERT(s = 1FX); + Assert(In.Done); + Assert(s = 1FX); In.String(s); - ASSERT(In.Done); - ASSERT(s = 0FFX); + Assert(In.Done); + Assert(s = 0FFX); In.Name(s); - ASSERT(In.Done); - ASSERT(s = "foo/bar"); + Assert(In.Done); + Assert(s = "foo/bar"); In.Line(s); - ASSERT(In.Done); - ASSERT(s = ""); + Assert(In.Done); + Assert(s = ""); In.Line(s); - ASSERT(In.Done); - ASSERT(s = "foo bar") + Assert(In.Done); + Assert(s = "foo bar") end InTest. diff --git a/lib/obnc/Input.obn b/lib/obnc/Input.obn index 77f5339..8f4f6da 100644 --- a/lib/obnc/Input.obn +++ b/lib/obnc/Input.obn @@ -38,5 +38,5 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Time; begin - ASSERT(Input0.TimeUnit > 0) (*silence "Input0 unused" compiler note*) + Assert(Input0.TimeUnit > 0) (*silence "Input0 unused" compiler note*) end Input. diff --git a/lib/obnc/Input0Test.obn b/lib/obnc/Input0Test.obn index 1e8764f..b6bd0a4 100644 --- a/lib/obnc/Input0Test.obn +++ b/lib/obnc/Input0Test.obn @@ -28,11 +28,11 @@ module Input0Test; n := Input.Available() until n >= 3; Input.Read(ch); - ASSERT(ch = "a"); + Assert(ch = "a"); Input.Read(ch); - ASSERT(ch = "b"); + Assert(ch = "b"); Input.Read(ch); - ASSERT(ch = "c"); + Assert(ch = "c"); Out.String("OK"); Out.Ln; end TestAvailable; @@ -44,14 +44,14 @@ module Input0Test; Out.String("Press space ... "); Out.Ln; Input.Read(ch); - ASSERT(ch = " "); + Assert(ch = " "); Out.String("OK"); Out.Ln; Out.String("Press $ ... "); Out.Ln; Input.Read(ch); - ASSERT(ch = "$"); + Assert(ch = "$"); Out.String("OK"); Out.Ln end TestRead; @@ -59,8 +59,8 @@ module Input0Test; procedure TestTime; begin - ASSERT(Input.TimeUnit > 0); - ASSERT(Input.Time() > 0) + Assert(Input.TimeUnit > 0); + Assert(Input.Time() > 0) end TestTime; diff --git a/lib/obnc/InputTest.obn b/lib/obnc/InputTest.obn index 67d5359..1d27470 100644 --- a/lib/obnc/InputTest.obn +++ b/lib/obnc/InputTest.obn @@ -27,7 +27,7 @@ module InputTest; repeat n := Input.Available() until n # 0; - ASSERT(n > 0); + Assert(n > 0); Out.String("OK"); Out.Ln; Input.Read(ch) @@ -40,14 +40,14 @@ module InputTest; Out.String("Press space ... "); Out.Ln; Input.Read(ch); - ASSERT(ch = " "); + Assert(ch = " "); Out.String("OK"); Out.Ln; Out.String("Press $ ... "); Out.Ln; Input.Read(ch); - ASSERT(ch = "$"); + Assert(ch = "$"); Out.String("OK"); Out.Ln end TestRead; @@ -67,9 +67,9 @@ module InputTest; repeat Input.Mouse(buttons, x, y); until buttons # {}; - ASSERT(button in buttons); - ASSERT(x >= 0); - ASSERT(y >= 0); + Assert(button in buttons); + Assert(x >= 0); + Assert(y >= 0); Out.String("OK"); Out.Ln; repeat (*wait until button has been released*) @@ -88,8 +88,8 @@ module InputTest; procedure TestTime; begin - ASSERT(Input.TimeUnit > 0); - ASSERT(Input.Time() > 0) + Assert(Input.TimeUnit > 0); + Assert(Input.Time() > 0) end TestTime; diff --git a/lib/obnc/MathTest.obn b/lib/obnc/MathTest.obn index caf5a54..d192ffd 100644 --- a/lib/obnc/MathTest.obn +++ b/lib/obnc/MathTest.obn @@ -23,72 +23,72 @@ module MathTest; eps = 0.01; begin - ASSERT(ABS(Math.sqrt(1.0) - 1.0) < eps); - ASSERT(ABS(Math.sqrt(4.0) - 2.0) < eps); + Assert(ABS(Math.sqrt(1.0) - 1.0) < eps); + Assert(ABS(Math.sqrt(4.0) - 2.0) < eps); - ASSERT(ABS(Math.power(0.0, 1.0) - 0.0) < eps); - ASSERT(ABS(Math.power(1.0, 0.0) - 1.0) < eps); - ASSERT(ABS(Math.power(2.0, 3.0) - 8.0) < eps); - ASSERT(ABS(Math.power(2.0, -3.0) - 1.0 / 8.0) < eps); + Assert(ABS(Math.power(0.0, 1.0) - 0.0) < eps); + Assert(ABS(Math.power(1.0, 0.0) - 1.0) < eps); + Assert(ABS(Math.power(2.0, 3.0) - 8.0) < eps); + Assert(ABS(Math.power(2.0, -3.0) - 1.0 / 8.0) < eps); - ASSERT(ABS(Math.exp(0.0) - 1.0) < eps); - ASSERT(ABS(Math.exp(1.0) - Math.e) < eps); - ASSERT(ABS(Math.exp(2.0) - Math.e * Math.e) < eps); - ASSERT(ABS(Math.exp(-2.0) - 1.0 / Math.e / Math.e) < eps); + Assert(ABS(Math.exp(0.0) - 1.0) < eps); + Assert(ABS(Math.exp(1.0) - Math.e) < eps); + Assert(ABS(Math.exp(2.0) - Math.e * Math.e) < eps); + Assert(ABS(Math.exp(-2.0) - 1.0 / Math.e / Math.e) < eps); - ASSERT(ABS(Math.ln(1.0) - 0.0) < eps); - ASSERT(ABS(Math.ln(Math.e) - 1.0) < eps); - ASSERT(ABS(Math.ln(Math.e * Math.e) - 2.0) < eps); + Assert(ABS(Math.ln(1.0) - 0.0) < eps); + Assert(ABS(Math.ln(Math.e) - 1.0) < eps); + Assert(ABS(Math.ln(Math.e * Math.e) - 2.0) < eps); - ASSERT(ABS(Math.log(1.0, 2.0) - 0.0) < eps); - ASSERT(ABS(Math.log(Math.e, Math.e) - 1.0) < eps); - ASSERT(ABS(Math.log(100.0, 10.0) - 2.0) < eps); + Assert(ABS(Math.log(1.0, 2.0) - 0.0) < eps); + Assert(ABS(Math.log(Math.e, Math.e) - 1.0) < eps); + Assert(ABS(Math.log(100.0, 10.0) - 2.0) < eps); - ASSERT(ABS(Math.round(0.4) - 0.0) < eps); - ASSERT(ABS(Math.round(-0.4) - 0.0) < eps); - ASSERT(ABS(Math.round(0.6) - 1.0) < eps); - ASSERT(ABS(Math.round(-0.6) - (-1.0)) < eps); + Assert(ABS(Math.round(0.4) - 0.0) < eps); + Assert(ABS(Math.round(-0.4) - 0.0) < eps); + Assert(ABS(Math.round(0.6) - 1.0) < eps); + Assert(ABS(Math.round(-0.6) - (-1.0)) < eps); - ASSERT(ABS(Math.sin(0.0) - 0.0) < eps); - ASSERT(ABS(Math.sin(Math.pi / 6.0) - 0.5) < eps); - ASSERT(ABS(Math.sin(Math.pi / 2.0) - 1.0) < eps); + Assert(ABS(Math.sin(0.0) - 0.0) < eps); + Assert(ABS(Math.sin(Math.pi / 6.0) - 0.5) < eps); + Assert(ABS(Math.sin(Math.pi / 2.0) - 1.0) < eps); - ASSERT(ABS(Math.cos(0.0) - 1.0) < eps); - ASSERT(ABS(Math.cos(Math.pi / 3.0) - 0.5) < eps); - ASSERT(ABS(Math.cos(Math.pi / 2.0) - 0.0) < eps); + Assert(ABS(Math.cos(0.0) - 1.0) < eps); + Assert(ABS(Math.cos(Math.pi / 3.0) - 0.5) < eps); + Assert(ABS(Math.cos(Math.pi / 2.0) - 0.0) < eps); - ASSERT(ABS(Math.tan(0.0) - 0.0) < eps); - ASSERT(ABS(Math.tan(Math.pi / 4.0) - 1.0) < eps); + Assert(ABS(Math.tan(0.0) - 0.0) < eps); + Assert(ABS(Math.tan(Math.pi / 4.0) - 1.0) < eps); - ASSERT(ABS(Math.arcsin(0.0) - 0.0) < eps); - ASSERT(ABS(Math.arcsin(0.5) - Math.pi / 6.0) < eps); - ASSERT(ABS(Math.arcsin(1.0) - Math.pi / 2.0) < eps); + Assert(ABS(Math.arcsin(0.0) - 0.0) < eps); + Assert(ABS(Math.arcsin(0.5) - Math.pi / 6.0) < eps); + Assert(ABS(Math.arcsin(1.0) - Math.pi / 2.0) < eps); - ASSERT(ABS(Math.arccos(1.0) - 0.0) < eps); - ASSERT(ABS(Math.arccos(0.5) - Math.pi / 3.0) < eps); - ASSERT(ABS(Math.arccos(0.0) - Math.pi / 2.0) < eps); + Assert(ABS(Math.arccos(1.0) - 0.0) < eps); + Assert(ABS(Math.arccos(0.5) - Math.pi / 3.0) < eps); + Assert(ABS(Math.arccos(0.0) - Math.pi / 2.0) < eps); - ASSERT(ABS(Math.arctan(0.0) - 0.0) < eps); - ASSERT(ABS(Math.arctan(1.0) - Math.pi / 4.0) < eps); + Assert(ABS(Math.arctan(0.0) - 0.0) < eps); + Assert(ABS(Math.arctan(1.0) - Math.pi / 4.0) < eps); - ASSERT(ABS(Math.arctan2(0.0, 2.0) - 0.0) < eps); - ASSERT(ABS(Math.arctan2(2.0, 2.0) - Math.pi / 4.0) < eps); + Assert(ABS(Math.arctan2(0.0, 2.0) - 0.0) < eps); + Assert(ABS(Math.arctan2(2.0, 2.0) - Math.pi / 4.0) < eps); - ASSERT(ABS(Math.sinh(0.0) - 0.0) < eps); - ASSERT(ABS(Math.sinh(1.0) - (Math.e - 1.0 / Math.e) / 2.0) < eps); + Assert(ABS(Math.sinh(0.0) - 0.0) < eps); + Assert(ABS(Math.sinh(1.0) - (Math.e - 1.0 / Math.e) / 2.0) < eps); - ASSERT(ABS(Math.cosh(0.0) - 1.0) < eps); - ASSERT(ABS(Math.cosh(1.0) - (Math.e + 1.0 / Math.e) / 2.0) < eps); + Assert(ABS(Math.cosh(0.0) - 1.0) < eps); + Assert(ABS(Math.cosh(1.0) - (Math.e + 1.0 / Math.e) / 2.0) < eps); - ASSERT(ABS(Math.tanh(0.0) - 0.0) < eps); - ASSERT(ABS(Math.tanh(1.0) - (Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) < eps); + Assert(ABS(Math.tanh(0.0) - 0.0) < eps); + Assert(ABS(Math.tanh(1.0) - (Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) < eps); - ASSERT(ABS(Math.arcsinh(0.0) - 0.0) < eps); - ASSERT(ABS(Math.arcsinh((Math.e - 1.0 / Math.e) / 2.0) - 1.0) < eps); + Assert(ABS(Math.arcsinh(0.0) - 0.0) < eps); + Assert(ABS(Math.arcsinh((Math.e - 1.0 / Math.e) / 2.0) - 1.0) < eps); - ASSERT(ABS(Math.arccosh(1.0) - 0.0) < eps); - ASSERT(ABS(Math.arccosh((Math.e + 1.0 / Math.e) / 2.0) - 1.0) < eps); + Assert(ABS(Math.arccosh(1.0) - 0.0) < eps); + Assert(ABS(Math.arccosh((Math.e + 1.0 / Math.e) / 2.0) - 1.0) < eps); - ASSERT(ABS(Math.arctanh(0.0) - 0.0) < eps); - ASSERT(ABS(Math.arctanh((Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) - 1.0) < eps) + Assert(ABS(Math.arctanh(0.0) - 0.0) < eps); + Assert(ABS(Math.arctanh((Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) - 1.0) < eps) end MathTest. diff --git a/lib/obnc/Strings.obn b/lib/obnc/Strings.obn index 30a10ab..ba95fd6 100644 --- a/lib/obnc/Strings.obn +++ b/lib/obnc/Strings.obn @@ -33,8 +33,8 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co i, lim: Int; begin destLength := Length(dest); - ASSERT(pos >= 0); - ASSERT(pos <= destLength); + Assert(pos >= 0); + Assert(pos <= destLength); sourceLength := Length(source); newLength := Min(destLength + sourceLength, LEN(dest) - 1); @@ -73,9 +73,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co var length, n1, i: Int; begin length := Length(s); - ASSERT(pos >= 0); - ASSERT(pos <= length); - ASSERT(n >= 0); + Assert(pos >= 0); + Assert(pos <= length); + Assert(n >= 0); n1 := Min(n, length - pos); (*actual number of characters to delete*) for i := pos to length - n1 do @@ -89,8 +89,8 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co var destLength, n, i: Int; begin destLength := Length(dest); - ASSERT(pos >= 0); - ASSERT(pos <= destLength); + Assert(pos >= 0); + Assert(pos <= destLength); n := Min(Length(source), LEN(dest) - 1 - pos); (*actual number of characters to replace*) @@ -110,8 +110,8 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co var sourceLength, n1, i: Int; begin sourceLength := Length(source); - ASSERT(pos >= 0); - ASSERT(pos <= sourceLength); + Assert(pos >= 0); + Assert(pos <= sourceLength); n1 := Min(n, Min(sourceLength - pos, LEN(dest) - 1)); (*actual number of characters to extract*) for i := 0 to n1 - 1 do @@ -125,8 +125,8 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co (**Pos(pat, s, pos) returns the position of the first occurrence of pat in s. Searching starts at position pos (0 <= pos <= Length(s)). If pat is not found, -1 is returned.*) var idxs, idxp, result: Int; begin - ASSERT(pos >= 0); - ASSERT(pos < LEN(s)); + Assert(pos >= 0); + Assert(pos < LEN(s)); idxs := pos - 1; repeat @@ -143,7 +143,7 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co result := -1 end; - ASSERT((result = -1) or (result >= 0) & (result + idxp < LEN(s))) + Assert((result = -1) or (result >= 0) & (result + idxp < LEN(s))) return result end Pos; diff --git a/lib/obnc/StringsTest.obn b/lib/obnc/StringsTest.obn index 1958cc4..f3933fa 100644 --- a/lib/obnc/StringsTest.obn +++ b/lib/obnc/StringsTest.obn @@ -25,93 +25,93 @@ module StringsTest; begin (*test Length*) - ASSERT(Strings.Length("") = 0); + Assert(Strings.Length("") = 0); shortStr := ""; - ASSERT(Strings.Length(shortStr) = 0); + Assert(Strings.Length(shortStr) = 0); shortStr := 22X; - ASSERT(Strings.Length(shortStr) = 1); + Assert(Strings.Length(shortStr) = 1); shortStr := "123"; - ASSERT(Strings.Length(shortStr) = 3); + Assert(Strings.Length(shortStr) = 3); (*test Insert*) s := "cde"; Strings.Insert("ab", 0, s); - ASSERT(s = "abcde"); + Assert(s = "abcde"); s := "adef"; Strings.Insert("bc", 1, s); - ASSERT(s = "abcdef"); + Assert(s = "abcdef"); shortStr := "ade"; Strings.Insert("bc", 1, shortStr); - ASSERT(shortStr = "abc"); + Assert(shortStr = "abc"); shortStr := "aef"; Strings.Insert("bcd", 1, shortStr); - ASSERT(shortStr = "abc"); + Assert(shortStr = "abc"); s := "foo bar"; Strings.Insert(" baz", Strings.Length(s), s); - ASSERT(s = "foo bar baz"); + Assert(s = "foo bar baz"); Strings.Insert(" qux qux qux qux qux", Strings.Length(s), s); - ASSERT(s = "foo bar baz q"); + Assert(s = "foo bar baz q"); (*test Append*) s := ""; Strings.Append("foo", s); - ASSERT(s = "foo"); + Assert(s = "foo"); Strings.Append(" bar", s); - ASSERT(s = "foo bar"); + Assert(s = "foo bar"); Strings.Append(" baz qux", s); - ASSERT(s = "foo bar baz q"); + Assert(s = "foo bar baz q"); (*test Delete*) s := "foo bar baz"; Strings.Delete(s, 11, 4); - ASSERT(s = "foo bar baz"); + Assert(s = "foo bar baz"); Strings.Delete(s, 7, 4); - ASSERT(s = "foo bar"); + Assert(s = "foo bar"); Strings.Delete(s, 0, 4); - ASSERT(s = "bar"); + Assert(s = "bar"); Strings.Delete(s, 1, 10); - ASSERT(s = "b"); + Assert(s = "b"); Strings.Delete(s, 0, 0); - ASSERT(s = "b"); + Assert(s = "b"); Strings.Delete(s, 0, 1); - ASSERT(s = ""); + Assert(s = ""); (*test Replace*) s := "foo bar baz"; Strings.Replace("qux", 4, s); - ASSERT(s = "foo qux baz"); + Assert(s = "foo qux baz"); s := "foo bar"; Strings.Replace("qux qux qux", 5, s); - ASSERT(s = "foo bqux qux "); + Assert(s = "foo bqux qux "); s := "foo"; Strings.Replace(" bar", 3, s); - ASSERT(s = "foo bar"); + Assert(s = "foo bar"); (*test Extract*) Strings.Extract("foo bar", 4, 3, shortStr); - ASSERT(shortStr = "bar"); + Assert(shortStr = "bar"); Strings.Extract("foo bar", 4, 10, shortStr); - ASSERT(shortStr = "bar"); + Assert(shortStr = "bar"); Strings.Extract("foo bar", 0, 6, shortStr); - ASSERT(shortStr = "foo"); + Assert(shortStr = "foo"); Strings.Extract("foo bar", 7, 4, shortStr); - ASSERT(shortStr = ""); + Assert(shortStr = ""); (*test Pos*) - ASSERT(Strings.Pos("", "", 0) = 0); - ASSERT(Strings.Pos("", "foo", 0) = 0); - ASSERT(Strings.Pos("", "foo", 1) = 1); - ASSERT(Strings.Pos("", "foo", 3) = 3); - ASSERT(Strings.Pos("foo", "foo", 0) = 0); - ASSERT(Strings.Pos("foo", "fool", 0) = 0); - ASSERT(Strings.Pos("ool", "fool", 0) = 1); - ASSERT(Strings.Pos("oo", "fool", 0) = 1); - ASSERT(Strings.Pos("fools", "fool", 0) = -1); - ASSERT(Strings.Pos("ools", "fool", 0) = -1); - ASSERT(Strings.Pos("ol", "fool", 1) = 2); + Assert(Strings.Pos("", "", 0) = 0); + Assert(Strings.Pos("", "foo", 0) = 0); + Assert(Strings.Pos("", "foo", 1) = 1); + Assert(Strings.Pos("", "foo", 3) = 3); + Assert(Strings.Pos("foo", "foo", 0) = 0); + Assert(Strings.Pos("foo", "fool", 0) = 0); + Assert(Strings.Pos("ool", "fool", 0) = 1); + Assert(Strings.Pos("oo", "fool", 0) = 1); + Assert(Strings.Pos("fools", "fool", 0) = -1); + Assert(Strings.Pos("ools", "fool", 0) = -1); + Assert(Strings.Pos("ol", "fool", 1) = 2); (*test Cap*) s := "foo Bar BAZ"; Strings.Cap(s); - ASSERT(s = "FOO BAR BAZ") + Assert(s = "FOO BAR BAZ") end StringsTest. diff --git a/lib/obnc/XYplane.obn b/lib/obnc/XYplane.obn index 4c88ee8..04fe889 100644 --- a/lib/obnc/XYplane.obn +++ b/lib/obnc/XYplane.obn @@ -81,5 +81,5 @@ end drawpixels. *) begin - ASSERT(Input.TimeUnit > 0) (*silence "Input unused" compiler note*) + Assert(Input.TimeUnit > 0) (*silence "Input unused" compiler note*) end XYplane. diff --git a/lib/obnc/XYplaneTest.obn b/lib/obnc/XYplaneTest.obn index 1d2ef37..c241114 100644 --- a/lib/obnc/XYplaneTest.obn +++ b/lib/obnc/XYplaneTest.obn @@ -26,10 +26,10 @@ module XYplaneTest; & (y >= 0) & (y < XYplane.H); XYplane.Clear; XYplane.Dot(x, y, XYplane.draw); - ASSERT(withinBounds & XYplane.IsDot(x, y) + Assert(withinBounds & XYplane.IsDot(x, y) or ~withinBounds & ~XYplane.IsDot(x, y)); XYplane.Dot(x, y, XYplane.erase); - ASSERT(~XYplane.IsDot(x, y)) + Assert(~XYplane.IsDot(x, y)) end TestPosition; @@ -73,18 +73,18 @@ module XYplaneTest; (*test SetSize*) XYplane.SetSize(640, 480); XYplane.Open; - ASSERT(XYplane.W = 640); - ASSERT(XYplane.H = 480); + Assert(XYplane.W = 640); + Assert(XYplane.H = 480); (*test UseColor and Color*) XYplane.UseColor(00FF3FH); XYplane.Dot(100, 100, XYplane.draw); - ASSERT(XYplane.Color(100, 100) = 00FF3FH); - ASSERT(XYplane.IsDot(100, 100)); + Assert(XYplane.Color(100, 100) = 00FF3FH); + Assert(XYplane.IsDot(100, 100)); XYplane.UseColor(0); XYplane.Dot(100, 100, XYplane.draw); - ASSERT(XYplane.Color(100, 100) = 0); - ASSERT(~XYplane.IsDot(100, 100)) + Assert(XYplane.Color(100, 100) = 0); + Assert(~XYplane.IsDot(100, 100)) end Run; begin diff --git a/src/.Oberon.y.swp b/src/.Oberon.y.swp new file mode 100644 index 0000000..0627e87 Binary files /dev/null and b/src/.Oberon.y.swp differ diff --git a/src/Oberon.y b/src/Oberon.y index e9d7ea9..a8290f4 100644 --- a/src/Oberon.y +++ b/src/Oberon.y @@ -3590,7 +3590,7 @@ static Trees_Node PredeclaredProcedureAST(const char procName[], Trees_Node expL static const struct { const char *name; int symbol; } symbols[] = { {"ABS", TREES_ABS_PROC}, {"ASR", TREES_ASR_PROC}, - {"ASSERT", TREES_ASSERT_PROC}, + {"Assert", TREES_ASSERT_PROC}, {"CHR", TREES_CHR_PROC}, {"DEC", TREES_DEC_PROC}, {"EXCL", TREES_EXCL_PROC}, @@ -3600,8 +3600,7 @@ static Trees_Node PredeclaredProcedureAST(const char procName[], Trees_Node expL {"INCL", TREES_INCL_PROC}, {"LEN", TREES_LEN_PROC}, {"LSL", TREES_LSL_PROC}, - {"NEW", TREES_NEW_PROC}, - {"ODD", TREES_ODD_PROC}, + {"New", TREES_NEW_PROC}, {"ORD", TREES_ORD_PROC}, {"PACK", TREES_PACK_PROC}, {"ROR", TREES_ROR_PROC}, diff --git a/src/Table.c b/src/Table.c index a3b0f2d..f375689 100644 --- a/src/Table.c +++ b/src/Table.c @@ -81,7 +81,7 @@ void Table_Init(void) static const struct { const char *name; int kind, type; } predecIdents[] = { {"ABS", TREES_PROCEDURE_KIND, TREES_ABS_PROC}, {"ASR", TREES_PROCEDURE_KIND, TREES_ASR_PROC}, - {"ASSERT", TREES_PROCEDURE_KIND, TREES_ASSERT_PROC}, + {"Assert", TREES_PROCEDURE_KIND, TREES_ASSERT_PROC}, {"Bool", TREES_TYPE_KIND, TREES_BOOLEAN_TYPE}, {"Byte", TREES_TYPE_KIND, TREES_BYTE_TYPE}, {"CHR", TREES_PROCEDURE_KIND, TREES_CHR_PROC}, @@ -95,7 +95,7 @@ void Table_Init(void) {"Int", TREES_TYPE_KIND, TREES_INTEGER_TYPE}, {"LEN", TREES_PROCEDURE_KIND, TREES_LEN_PROC}, {"LSL", TREES_PROCEDURE_KIND, TREES_LSL_PROC}, - {"NEW", TREES_PROCEDURE_KIND, TREES_NEW_PROC}, + {"New", TREES_PROCEDURE_KIND, TREES_NEW_PROC}, {"ORD", TREES_PROCEDURE_KIND, TREES_ORD_PROC}, {"PACK", TREES_PROCEDURE_KIND, TREES_PACK_PROC}, {"ROR", TREES_PROCEDURE_KIND, TREES_ROR_PROC}, diff --git a/src/y.tab.c b/src/y.tab.c index c754de4..aaab518 100644 --- a/src/y.tab.c +++ b/src/y.tab.c @@ -5568,7 +5568,7 @@ static Trees_Node PredeclaredProcedureAST(const char procName[], Trees_Node expL static const struct { const char *name; int symbol; } symbols[] = { {"ABS", TREES_ABS_PROC}, {"ASR", TREES_ASR_PROC}, - {"ASSERT", TREES_ASSERT_PROC}, + {"Assert", TREES_ASSERT_PROC}, {"CHR", TREES_CHR_PROC}, {"DEC", TREES_DEC_PROC}, {"EXCL", TREES_EXCL_PROC}, @@ -5578,8 +5578,7 @@ static Trees_Node PredeclaredProcedureAST(const char procName[], Trees_Node expL {"INCL", TREES_INCL_PROC}, {"LEN", TREES_LEN_PROC}, {"LSL", TREES_LSL_PROC}, - {"NEW", TREES_NEW_PROC}, - {"ODD", TREES_ODD_PROC}, + {"New", TREES_NEW_PROC}, {"ORD", TREES_ORD_PROC}, {"PACK", TREES_PACK_PROC}, {"ROR", TREES_ROR_PROC}, diff --git a/subword b/subword new file mode 100755 index 0000000..6cda803 --- /dev/null +++ b/subword @@ -0,0 +1,2 @@ +#!/bin/sh +find . -type f -name "*$3*" -exec sed -i -e "s/\\b$1\\b/$2/g" {} \; diff --git a/tests/obnc/failing-at-compile-time/T7ActualVarParamImported1.obn b/tests/obnc/failing-at-compile-time/T7ActualVarParamImported1.obn index 06797e0..dd44ca7 100644 --- a/tests/obnc/failing-at-compile-time/T7ActualVarParamImported1.obn +++ b/tests/obnc/failing-at-compile-time/T7ActualVarParamImported1.obn @@ -20,5 +20,5 @@ module T7ActualVarParamImported1; import A; begin - NEW(A.p) + New(A.p) end T7ActualVarParamImported1. diff --git a/tests/obnc/passing/T2TypeDeclarations.obn b/tests/obnc/passing/T2TypeDeclarations.obn index 4de46c6..7ba35de 100644 --- a/tests/obnc/passing/T2TypeDeclarations.obn +++ b/tests/obnc/passing/T2TypeDeclarations.obn @@ -91,13 +91,13 @@ module T2TypeDeclarations; proc: procedure end; begin - NEW(x); - ASSERT(x.ptr = nil); - NEW(y); - ASSERT(y.proc = nil); - NEW(z); - ASSERT(z.ptr = nil); - ASSERT(z.proc = nil) + New(x); + Assert(x.ptr = nil); + New(y); + Assert(y.proc = nil); + New(z); + Assert(z.ptr = nil); + Assert(z.proc = nil) end TestMemoryAllocation; @@ -116,7 +116,7 @@ module T2TypeDeclarations; var x: P; y: T; begin - NEW(x); + New(x); x.i := 1; y.f := 1 end TestScope; @@ -125,16 +125,16 @@ begin TestMemoryAllocation; s1 := s; table[0] := nil; - NEW(t); - NEW(i); + New(t); + New(i); t.content := i; t.content(IntegerNode).value := 1; t.proc := TreeProc; - NEW(e); + New(e); n.elem := left; n.next := nil; n.p := NodeProc; - NEW(p); + New(p); a[0].f := nil; TestScope end T2TypeDeclarations. diff --git a/tests/obnc/passing/T3VariableDeclarations.obn b/tests/obnc/passing/T3VariableDeclarations.obn index 9b06f43..fcfb2d6 100644 --- a/tests/obnc/passing/T3VariableDeclarations.obn +++ b/tests/obnc/passing/T3VariableDeclarations.obn @@ -39,7 +39,7 @@ module T3VariableDeclarations; procedure AssertVector(var v: Vector); begin - ASSERT(v is Vector) + Assert(v is Vector) end AssertVector; begin @@ -49,8 +49,8 @@ module T3VariableDeclarations; AssertVector(rs[0].pos); AssertVector(rs[0].size); - NEW(rp); - ASSERT(rp is Rectangle); + New(rp); + Assert(rp is Rectangle); AssertVector(rp.pos); AssertVector(rp.size); end TestInitialization; diff --git a/tests/obnc/passing/T4Expressions.obn b/tests/obnc/passing/T4Expressions.obn index d700b0b..35b9162 100644 --- a/tests/obnc/passing/T4Expressions.obn +++ b/tests/obnc/passing/T4Expressions.obn @@ -48,21 +48,21 @@ module T4Expressions; begin s := "hello"; - ASSERT(s[1] = "e"); + Assert(s[1] = "e"); A[1, 2] := 1; - ASSERT(A[1, 2] = A[1][2]); + Assert(A[1, 2] = A[1][2]); i := 0; j := 0; A[0, 0] := ABS(A[IncReturnZero(i), IncReturnZero(j)]); - ASSERT(i = 1); - ASSERT(j = 1); + Assert(i = 1); + Assert(j = 1); - NEW(a[0]); + New(a[0]); a[0].a[0] := 1; - ASSERT(a[0].a[0] = 1); + Assert(a[0].a[0] = 1); a[0]^.f := F; - ASSERT(a[0].f() = 1); + Assert(a[0].f() = 1); end TestDesignators; @@ -76,13 +76,13 @@ module T4Expressions; Out.Integer(ORD({1, 2, a, 5, b, 8}), 0); Out.Ln; Out.Integer(ORD({1, 2, a..b, 8}), 0); Out.Ln; Out.Integer(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; - ASSERT({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}); + Assert({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}); i := 0; j := 0; A := {IncReturnZero(i)..IncReturnZero(j)}; - ASSERT(A = {0}); - ASSERT(i = 1); - ASSERT(j = 1) + Assert(A = {0}); + Assert(i = 1); + Assert(j = 1) end TestSetConstructors; @@ -103,147 +103,147 @@ Out.Integer(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; t1: T1; begin (*booleans*) - ASSERT(true = true); - ASSERT(true # false); + Assert(true = true); + Assert(true # false); b := true; b1 := false; - ASSERT(b = true); - ASSERT(b1 # true); + Assert(b = true); + Assert(b1 # true); (*characters / single-character strings*) ch := 0X; ch1 := "a"; - ASSERT(ch = 0X); - ASSERT(ch # "a"); - ASSERT(ch < ch1); - ASSERT(ch <= 0X); - ASSERT(ch <= "a"); - ASSERT(ch1 > ch); - (*ASSERT(ch >= 0X);*) - ASSERT("a" >= ch); + Assert(ch = 0X); + Assert(ch # "a"); + Assert(ch < ch1); + Assert(ch <= 0X); + Assert(ch <= "a"); + Assert(ch1 > ch); + (*Assert(ch >= 0X);*) + Assert("a" >= ch); ch := 7FX; ch1 := 80X; - ASSERT(ch < ch1); + Assert(ch < ch1); (*integers*) - ASSERT(0 = 0); - ASSERT(0 # 1); - ASSERT(0 < 1); - ASSERT(0 <= 0); - ASSERT(0 <= 1); - ASSERT(1 > 0); - ASSERT(0 >= 0); - ASSERT(1 >= 0); - ASSERT(0 in {0}); - ASSERT(~(1 in {0})); + Assert(0 = 0); + Assert(0 # 1); + Assert(0 < 1); + Assert(0 <= 0); + Assert(0 <= 1); + Assert(1 > 0); + Assert(0 >= 0); + Assert(1 >= 0); + Assert(0 in {0}); + Assert(~(1 in {0})); n := 0; - ASSERT(n = 0); - ASSERT(n # 1); - ASSERT(n < 1); - ASSERT(n <= 0); - ASSERT(n <= 1); - ASSERT(n < 1); - ASSERT(n >= 0); - ASSERT(n >= -1); - ASSERT(n in {0}); - ASSERT(~(1 in {n})); + Assert(n = 0); + Assert(n # 1); + Assert(n < 1); + Assert(n <= 0); + Assert(n <= 1); + Assert(n < 1); + Assert(n >= 0); + Assert(n >= -1); + Assert(n in {0}); + Assert(~(1 in {n})); i := 0; j := 0; b := IncReturnZero(i) in IncReturnEmpty(j); - ASSERT(i = 1); - ASSERT(j = 1); + Assert(i = 1); + Assert(j = 1); (*real numbers*) - ASSERT(0.0 = 0.0); - ASSERT(0.0 # 1.0); - ASSERT(0.0 < 1.0); - ASSERT(0.0 <= 0.0); - ASSERT(0.0 <= 1.0); - ASSERT(1.0 > 0.0); - ASSERT(0.0 >= 0.0); - ASSERT(1.0 >= 0.0); + Assert(0.0 = 0.0); + Assert(0.0 # 1.0); + Assert(0.0 < 1.0); + Assert(0.0 <= 0.0); + Assert(0.0 <= 1.0); + Assert(1.0 > 0.0); + Assert(0.0 >= 0.0); + Assert(1.0 >= 0.0); x := 0.0; - ASSERT(x = 0.0); - ASSERT(x # 1.0); - ASSERT(x < 1.0); - ASSERT(x <= 0.0); - ASSERT(x <= 1.0); - ASSERT(1.0 > x); - ASSERT(x >= 0.0); - ASSERT(x >= -1.0); + Assert(x = 0.0); + Assert(x # 1.0); + Assert(x < 1.0); + Assert(x <= 0.0); + Assert(x <= 1.0); + Assert(1.0 > x); + Assert(x >= 0.0); + Assert(x >= -1.0); (*bytes*) y := 0; - ASSERT(y = 0); - ASSERT(y < 1); - ASSERT(y <= 0); - ASSERT(y <= 1); - ASSERT(1 > y); - (*ASSERT(y >= 0);*) - ASSERT(y in {0}); - ASSERT(~(1 in {y})); + Assert(y = 0); + Assert(y < 1); + Assert(y <= 0); + Assert(y <= 1); + Assert(1 > y); + (*Assert(y >= 0);*) + Assert(y in {0}); + Assert(~(1 in {y})); (*sets*) - ASSERT({0, 1} = {1, 0}); - ASSERT({0} # {0, 1}); - ASSERT({1 .. 0} = {}); + Assert({0, 1} = {1, 0}); + Assert({0} # {0, 1}); + Assert({1 .. 0} = {}); n := 1; - ASSERT({n .. 0} = {}); + Assert({n .. 0} = {}); A := {0}; B := {0, 1}; - ASSERT(A = {0}); - ASSERT(B # {0}); - ASSERT(A # B); + Assert(A = {0}); + Assert(B # {0}); + Assert(A # B); (*strings / characters / character arrays*) - ASSERT("foo" = "foo"); - ASSERT("foo" # "bar"); - ASSERT("bar" < "foo"); - ASSERT("foo" <= "foo"); - ASSERT("bar" <= "foo"); - ASSERT("foo" > "bar"); - ASSERT("foo" >= "foo"); - ASSERT("foo" >= "bar"); + Assert("foo" = "foo"); + Assert("foo" # "bar"); + Assert("bar" < "foo"); + Assert("foo" <= "foo"); + Assert("bar" <= "foo"); + Assert("foo" > "bar"); + Assert("foo" >= "foo"); + Assert("foo" >= "bar"); ch := "b"; - ASSERT("b" = ch); - ASSERT("f" # ch); - ASSERT(ch < "c"); - ASSERT("b" <= ch); - ASSERT("a" <= ch); - ASSERT("c" > ch); - ASSERT("b" >= ch); - ASSERT("c" >= ch); + Assert("b" = ch); + Assert("f" # ch); + Assert(ch < "c"); + Assert("b" <= ch); + Assert("a" <= ch); + Assert("c" > ch); + Assert("b" >= ch); + Assert("c" >= ch); str := "foo"; - ASSERT("foo" = str); - ASSERT("fool" # str); - ASSERT("fo" # str); - ASSERT("bar" # str); - ASSERT("bar" < str); - ASSERT("fo" < str); - ASSERT("foo" <= str); - ASSERT("bar" <= str); - ASSERT("qux" > str); - ASSERT("foo" >= str); - ASSERT("qux" >= str); + Assert("foo" = str); + Assert("fool" # str); + Assert("fo" # str); + Assert("bar" # str); + Assert("bar" < str); + Assert("fo" < str); + Assert("foo" <= str); + Assert("bar" <= str); + Assert("qux" > str); + Assert("foo" >= str); + Assert("qux" >= str); strs[0] := ""; strs[1] := "bar"; - ASSERT(~(str = strs[1])); - ASSERT(str # strs[1]); - ASSERT(~(str < strs[1])); - ASSERT(~(str <= strs[1])); - ASSERT(str > strs[1]); - ASSERT(str >= strs[1]); + Assert(~(str = strs[1])); + Assert(str # strs[1]); + Assert(~(str < strs[1])); + Assert(~(str <= strs[1])); + Assert(str > strs[1]); + Assert(str >= strs[1]); str[0] := 7FX; str[1] := 0X; strs[1][0] := 80X; strs[1][1] := 0X; - ASSERT(str < strs[1]); + Assert(str < strs[1]); (*pointers*) - NEW(t1); + New(t1); t := t1; - ASSERT(t = t1); - ASSERT(t1 = t); + Assert(t = t1); + Assert(t1 = t); t := nil; - ASSERT((t is T) or ~(t is T)) (*The value of nil is T is undefined.*) + Assert((t is T) or ~(t is T)) (*The value of nil is T is undefined.*) end TestRelationalOperations; @@ -256,62 +256,62 @@ Out.Integer(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; A: Set; begin (*booleans*) - ASSERT(true or true); - ASSERT(true or false); - ASSERT(false or true); + Assert(true or true); + Assert(true or false); + Assert(false or true); b := true; - ASSERT(b or true); - ASSERT(b or false); - ASSERT(false or b); + Assert(b or true); + Assert(b or false); + Assert(false or b); (*integers*) - ASSERT(1 + 1 = 2); - ASSERT(1 - 1 = 0); + Assert(1 + 1 = 2); + Assert(1 - 1 = 0); n := 1; - ASSERT(+n = +1); - ASSERT(-n = -1); - ASSERT(n + 1 = 2); - ASSERT(n - 1 = 0); - ASSERT(-n + 1 = 0); - ASSERT(-n - 1 = -2); + Assert(+n = +1); + Assert(-n = -1); + Assert(n + 1 = 2); + Assert(n - 1 = 0); + Assert(-n + 1 = 0); + Assert(-n - 1 = -2); (*reals*) - ASSERT(1.0 + 1.0 >= 2.0 - eps); - ASSERT(1.0 + 1.0 <= 2.0 + eps); - ASSERT(1.0 - 1.0 >= -eps); - ASSERT(1.0 - 1.0 <= eps); + Assert(1.0 + 1.0 >= 2.0 - eps); + Assert(1.0 + 1.0 <= 2.0 + eps); + Assert(1.0 - 1.0 >= -eps); + Assert(1.0 - 1.0 <= eps); x := 1.0; - ASSERT(+x = +1.0); - ASSERT(-x = -1.0); - ASSERT(x + 1.0 >= 2.0 - eps); - ASSERT(x + 1.0 <= 2.0 + eps); - ASSERT(x - 1.0 >= -eps); - ASSERT(x - 1.0 <= eps); - ASSERT(-x + 1.0 >= - eps); - ASSERT(-x + 1.0 <= eps); - ASSERT(-x - 1.0 >= -2.0 - eps); - ASSERT(-x - 1.0 <= -2.0 + eps); + Assert(+x = +1.0); + Assert(-x = -1.0); + Assert(x + 1.0 >= 2.0 - eps); + Assert(x + 1.0 <= 2.0 + eps); + Assert(x - 1.0 >= -eps); + Assert(x - 1.0 <= eps); + Assert(-x + 1.0 >= - eps); + Assert(-x + 1.0 <= eps); + Assert(-x - 1.0 >= -2.0 - eps); + Assert(-x - 1.0 <= -2.0 + eps); if SYSTEM.SIZE(Real) > 8 then x := 2.0E+308; (*greater than maximum value of binary64*) - ASSERT(x > 1.0E+308); - ASSERT(x < 3.0E+308) + Assert(x > 1.0E+308); + Assert(x < 3.0E+308) end; (*bytes*) y := 1; - ASSERT(+y = +1); - ASSERT(-y = -1); - ASSERT(y + 1= 2); - ASSERT(1 - y = 0); + Assert(+y = +1); + Assert(-y = -1); + Assert(y + 1= 2); + Assert(1 - y = 0); (*sets*) - ASSERT({0, 1} + (-{0, 1}) = -{}); - ASSERT({0, 1} + {0, 2} = {0 .. 2}); - ASSERT({0, 1} - {0, 2} = {1}); + Assert({0, 1} + (-{0, 1}) = -{}); + Assert({0, 1} + {0, 2} = {0 .. 2}); + Assert({0, 1} - {0, 2} = {1}); A := {0, 1}; - ASSERT(A + (-{0, 1}) = -{}); - ASSERT(A + {0, 2} = {0 .. 2}); - ASSERT(A - {0, 2} = {1}) + Assert(A + (-{0, 1}) = -{}); + Assert(A + {0, 2} = {0 .. 2}); + Assert(A - {0, 2} = {1}) end TestAdditiveOperations; @@ -324,54 +324,54 @@ Out.Integer(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; A: Set; begin (*booleans*) - ASSERT(true & true); + Assert(true & true); b := true; - ASSERT(b & true); + Assert(b & true); (*integers*) - ASSERT(9 * 2 = 18); - ASSERT(9 div 4 = 2); - ASSERT((-9) div 4 = -3); - ASSERT(9 mod 4 = 1); - ASSERT((-9) mod 4 = 3); + Assert(9 * 2 = 18); + Assert(9 div 4 = 2); + Assert((-9) div 4 = -3); + Assert(9 mod 4 = 1); + Assert((-9) mod 4 = 3); n := -9; y := 4; - ASSERT(n * y = -36); - ASSERT(n div y = -3); - ASSERT(n mod y = 3); + Assert(n * y = -36); + Assert(n div y = -3); + Assert(n mod y = 3); i := 1; j := 1; n := (IncReturnZero(i) + 3) div (IncReturnZero(j) + 2); - ASSERT(n = 1); - ASSERT(i = 2); - ASSERT(j = 2); + Assert(n = 1); + Assert(i = 2); + Assert(j = 2); n := IncReturnZero(i) mod (IncReturnZero(j) + 1); - ASSERT(i = 3); - ASSERT(j = 3); + Assert(i = 3); + Assert(j = 3); (*reals*) - ASSERT(9.0 * 2.0 >= 18.0 - eps); - ASSERT(9.0 * 2.0 <= 18.0 + eps); - ASSERT(9.0 / 2.0 >= 4.5 - eps); - ASSERT(9.0 / 2.0 <= 4.5 + eps); + Assert(9.0 * 2.0 >= 18.0 - eps); + Assert(9.0 * 2.0 <= 18.0 + eps); + Assert(9.0 / 2.0 >= 4.5 - eps); + Assert(9.0 / 2.0 <= 4.5 + eps); x := 9.0; - ASSERT(x * 2.0 >= 18.0 - eps); - ASSERT(x * 2.0 <= 18.0 + eps); - ASSERT(x / 2.0 >= 4.5 - eps); - ASSERT(x / 2.0 <= 4.5 + eps); + Assert(x * 2.0 >= 18.0 - eps); + Assert(x * 2.0 <= 18.0 + eps); + Assert(x / 2.0 >= 4.5 - eps); + Assert(x / 2.0 <= 4.5 + eps); (*bytes*) y := 9; - ASSERT(y * 2 = 18); - (*ASSERT(y div 4 = 2); - ASSERT(y mod 4 = 1);*) + Assert(y * 2 = 18); + (*Assert(y div 4 = 2); + Assert(y mod 4 = 1);*) (*sets*) - ASSERT({0, 1} * {1, 2} = {1}); - ASSERT({0, 1} / {1, 2} = {0, 2}); + Assert({0, 1} * {1, 2} = {1}); + Assert({0, 1} / {1, 2} = {0, 2}); A := {0, 1}; - ASSERT(A * {1, 2} = {1}); - ASSERT(A / {1, 2} = {0, 2}) + Assert(A * {1, 2} = {1}); + Assert(A / {1, 2} = {0, 2}) end TestMultiplicativeOperations; @@ -395,82 +395,82 @@ Out.Integer(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; x: Byte; s: Set; begin - ASSERT(ABS(-1) = 1); - ASSERT(ABS(0) = 0); - ASSERT(ABS(1) = 1); - ASSERT(ABS(-1.0) = 1.0); - ASSERT(ABS(0.0) = 0.0); - ASSERT(ABS(1.0) = 1.0); + Assert(ABS(-1) = 1); + Assert(ABS(0) = 0); + Assert(ABS(1) = 1); + Assert(ABS(-1.0) = 1.0); + Assert(ABS(0.0) = 0.0); + Assert(ABS(1.0) = 1.0); i := 0; j := ABS(IncReturnZero(i) - 1); - ASSERT(j = 1); - ASSERT(i = 1); + Assert(j = 1); + Assert(i = 1); a := ""; - ASSERT(LEN(a) = 10); + Assert(LEN(a) = 10); - ASSERT(LSL(0, 0) = 0); - ASSERT(LSL(0, 1) = 0); - ASSERT(LSL(1, 0) = 1); - ASSERT(LSL(1, 1) = 2); + Assert(LSL(0, 0) = 0); + Assert(LSL(0, 1) = 0); + Assert(LSL(1, 0) = 1); + Assert(LSL(1, 1) = 2); - ASSERT(ASR(0, 0) = 0); - ASSERT(ASR(0, 1) = 0); - ASSERT(ASR(1, 0) = 1); - ASSERT(ASR(1, 1) = 0); + Assert(ASR(0, 0) = 0); + Assert(ASR(0, 1) = 0); + Assert(ASR(1, 0) = 1); + Assert(ASR(1, 1) = 0); - ASSERT(ROR(0, 1) = 0); - ASSERT(ROR(2, 1) = 1); + Assert(ROR(0, 1) = 0); + Assert(ROR(2, 1) = 1); i := 0; j := 0; k := ROR(IncReturnZero(i) + 2, IncReturnZero(j) + 1); - ASSERT(k = 1); - ASSERT(i = 1); - ASSERT(j = 1); + Assert(k = 1); + Assert(i = 1); + Assert(j = 1); - ASSERT(FLOOR(-1.5) = -2); - ASSERT(FLOOR(0.0) = 0); - ASSERT(FLOOR(1.5) = 1); + Assert(FLOOR(-1.5) = -2); + Assert(FLOOR(0.0) = 0); + Assert(FLOOR(1.5) = 1); i := 0; j := FLOOR(FLT(IncReturnZero(i)) + 1.5); - ASSERT(j = 1); - ASSERT(i = 1); + Assert(j = 1); + Assert(i = 1); - ASSERT(FLT(-1) = -1.0); - ASSERT(FLT(0) = 0.0); - ASSERT(FLT(1) = 1.0); + Assert(FLT(-1) = -1.0); + Assert(FLT(0) = 0.0); + Assert(FLT(1) = 1.0); - ASSERT(ORD(0X) = 0); + Assert(ORD(0X) = 0); ch := 0X; - ASSERT(ORD(ch) = 0); - ASSERT(ORD("A") = 41H); + Assert(ORD(ch) = 0); + Assert(ORD("A") = 41H); ch := "A"; - ASSERT(ORD(ch) = 41H); - ASSERT(ORD(0FFX) = 0FFH); + Assert(ORD(ch) = 41H); + Assert(ORD(0FFX) = 0FFH); ch := 0FFX; - ASSERT(ORD(ch) = 0FFH); + Assert(ORD(ch) = 0FFH); - ASSERT(ORD(false) = 0); + Assert(ORD(false) = 0); b := false; - ASSERT(ORD(b) = 0); - ASSERT(ORD(true) = 1); + Assert(ORD(b) = 0); + Assert(ORD(true) = 1); b := true; - ASSERT(ORD(b) = 1); + Assert(ORD(b) = 1); - ASSERT(ORD({}) = 0); + Assert(ORD({}) = 0); s := {}; - ASSERT(ORD(s) = 0); - ASSERT(ORD({8}) = 256); + Assert(ORD(s) = 0); + Assert(ORD({8}) = 256); s := {8}; - ASSERT(ORD(s) = 256); + Assert(ORD(s) = 256); - ASSERT(CHR(0) = 0X); - ASSERT(CHR(1) = 1X); - ASSERT(CHR(7FH) = 7FX); + Assert(CHR(0) = 0X); + Assert(CHR(1) = 1X); + Assert(CHR(7FH) = 7FX); ch := 7FX; - ASSERT(CHR(7FH) = ch); + Assert(CHR(7FH) = ch); x := 1; - ASSERT(CHR(x) = 1X); + Assert(CHR(x) = 1X); i := absConst; i := lslConst; diff --git a/tests/obnc/passing/T5Statements.obn b/tests/obnc/passing/T5Statements.obn index db6d924..3b89f44 100644 --- a/tests/obnc/passing/T5Statements.obn +++ b/tests/obnc/passing/T5Statements.obn @@ -52,30 +52,30 @@ module T5Statements; b := true; b1 := false; b := b1; - ASSERT(b = b1); + Assert(b = b1); ch := "a"; ch1 := 22X; ch := ch1; - ASSERT(ch = ch1); + Assert(ch = ch1); n := 0; n1 := -1; n := n1; - ASSERT(n = n1); + Assert(n = n1); x := 0.0; x1 := -1.0; x := x1; - ASSERT(x = x1); + Assert(x = x1); y := 0; y1 := 255; y := y1; - ASSERT(y = y1); + Assert(y = y1); n := 0; y := n; - ASSERT(y = n); + Assert(y = n); A := {}; A1 := {0, 1}; A := A1; - ASSERT(A = A1); + Assert(A = A1); end TestBasicAssignments; @@ -93,38 +93,38 @@ module T5Statements; var t: array 128 of Char; begin t := s; - ASSERT(t = s) + Assert(t = s) end AssignOpenArray; procedure AssignMultiDimOpenArray(s: array of array of String); var t: array 2 of String; begin t := s[0]; - ASSERT(t[0] = s[0, 0]); - ASSERT(t[1] = s[0, 1]) + Assert(t[0] = s[0, 0]); + Assert(t[1] = s[0, 1]) end AssignMultiDimOpenArray; begin str := "testing, testing..."; str1 := "more testing..."; str := str1; - ASSERT(str = str1); + Assert(str = str1); AssignString(str); - ASSERT(str = "hello"); + Assert(str = "hello"); AssignOpenArray("hello"); strs[0] := "foo"; - ASSERT(strs[0] = "foo"); + Assert(strs[0] = "foo"); strs[1] := "bar"; - ASSERT(strs[1] = "bar"); + Assert(strs[1] = "bar"); strs[1] := strs[0]; - ASSERT(strs[1] = "foo"); + Assert(strs[1] = "foo"); strs[0] := "foo"; strs[1] := "bar"; strs1 := strs; - ASSERT(strs1[0] = "foo"); - ASSERT(strs1[1] = "bar"); + Assert(strs1[0] = "foo"); + Assert(strs1[1] = "bar"); AssignMultiDimOpenArray(strs2) end TestArrayAssignments; @@ -140,7 +140,7 @@ module T5Statements; procedure P(var s: ShapeDesc); begin - ASSERT(s is CircleDesc); + Assert(s is CircleDesc); s(CircleDesc) := s(CircleDesc); s(CircleDesc).r := 1.0 end P; @@ -153,17 +153,17 @@ module T5Statements; begin foo.i := 37; bar := foo; - ASSERT(bar.i = 37); + Assert(bar.i = 37); s.x := 0.0; s.y := 0.0; r.x := 0.0; P(c); - ASSERT(ABS(c.r - 1.0) < eps); + Assert(ABS(c.r - 1.0) < eps); r.x := 1.0; s := r; - ASSERT(s.x = r.x); + Assert(s.x = r.x); P(a[9]); @@ -178,14 +178,14 @@ module T5Statements; r: pointer to RectangleDesc; r1: pointer to RectangleDesc; begin - NEW(x); + New(x); y := x; - ASSERT(y is Rectangle); - NEW(r); + Assert(y is Rectangle); + New(r); s := r; - ASSERT(s is RectangleDesc); + Assert(s is RectangleDesc); r1 := r; - ASSERT(r1 is RectangleDesc) + Assert(r1 is RectangleDesc) end TestPointerAssignments; @@ -274,7 +274,7 @@ module T5Statements; procedure P7(var t: T0); begin - ASSERT(t is T1) + Assert(t is T1) end P7; begin @@ -287,7 +287,7 @@ module T5Statements; P6("test"); s := "test"; P6(s); - NEW(p1); + New(p1); p0 := p1; P7(p0^) end TestProcedureCalls; @@ -311,60 +311,60 @@ module T5Statements; begin n := 0; INC(n); - ASSERT(n = 1); + Assert(n = 1); n := 0; INC(n, 10); - ASSERT(n = 10); + Assert(n = 10); n := 0; DEC(n); - ASSERT(n = -1); + Assert(n = -1); n := 0; DEC(n, 10); - ASSERT(n = -10); + Assert(n = -10); A := {}; INCL(A, 0); - ASSERT(A = {0}); + Assert(A = {0}); A := {0}; EXCL(A, 0); - ASSERT(A = {}); + Assert(A = {}); - NEW(v); - ASSERT(v # nil); + New(v); + Assert(v # nil); v.f := 1; - ASSERT(v.f = 1); + Assert(v.f = 1); x := 1.0; PACK(x, 2); - ASSERT(x >= 4.0 - eps); - ASSERT(x <= 4.0 + eps); + Assert(x >= 4.0 - eps); + Assert(x <= 4.0 + eps); a[0] := 1.0; i := 0; j := 0; PACK(a[IncReturnZero(i)], IncReturnZero(j) + 2); - ASSERT(a[0] >= 4.0 - eps); - ASSERT(a[0] <= 4.0 + eps); - ASSERT(i = 1); - ASSERT(j = 1); + Assert(a[0] >= 4.0 - eps); + Assert(a[0] <= 4.0 + eps); + Assert(i = 1); + Assert(j = 1); x := 4.0; UNPK(x, n); - ASSERT(x >= 1.0); - ASSERT(x < 2.0); - ASSERT(n = 2); + Assert(x >= 1.0); + Assert(x < 2.0); + Assert(n = 2); a[0] := 4.0; i := 0; j := 0; UNPK(a[IncReturnZero(i)], b[IncReturnZero(j)]); - ASSERT(a[0] >= 1.0); - ASSERT(a[0] < 2.0); - ASSERT(b[0] = 2); - ASSERT(i = 1); - ASSERT(j = 1) + Assert(a[0] >= 1.0); + Assert(a[0] < 2.0); + Assert(b[0] = 2); + Assert(i = 1); + Assert(j = 1) end TestPredeclaredProperProcedures; @@ -375,14 +375,14 @@ module T5Statements; if n = 0 then n := 1 end; - ASSERT(n = 1); + Assert(n = 1); n := 1; if n = 0 then n := 1 else n := 2 end; - ASSERT(n = 2); + Assert(n = 2); n := 2; if n = 0 then n := 1 @@ -391,7 +391,7 @@ module T5Statements; else n := 3 end; - ASSERT(n = 3) + Assert(n = 3) end TestIfStatements; @@ -432,7 +432,7 @@ module T5Statements; | 10, 12 .. 20: n := 0 end; - ASSERT(n = 0); + Assert(n = 0); ch := "u"; case ch of | 0X: @@ -442,8 +442,8 @@ module T5Statements; | "l", "m" .. "z": ch := 0X end; - ASSERT(ch = 0X); - NEW(rp); + Assert(ch = 0X); + New(rp); sp := rp; case sp of (*Shape: @@ -454,10 +454,10 @@ module T5Statements; | Circle: sp.r := 1.0 end; - ASSERT(sp(Rectangle).w = 1.0); - ASSERT(sp(Rectangle).h = 2.0); + Assert(sp(Rectangle).w = 1.0); + Assert(sp(Rectangle).h = 2.0); P(c); - ASSERT(c.r = 1.0); + Assert(c.r = 1.0); end TestCaseStatements; @@ -470,7 +470,7 @@ module T5Statements; n := n + 1; i := i + 1 end; - ASSERT(n = 10); + Assert(n = 10); n := 4; n1 := 6; while n > n1 do @@ -478,8 +478,8 @@ module T5Statements; elsif n1 > n do n1 := n1 - n end; - ASSERT(n = 2); - ASSERT(n1 = 2); + Assert(n = 2); + Assert(n1 = 2); n := 5; n1 := 6; while n > n1 do @@ -487,8 +487,8 @@ module T5Statements; elsif n1 > n do n1 := n1 - n end; - ASSERT(n = 1); - ASSERT(n1 = 1); + Assert(n = 1); + Assert(n1 = 1); end TestWhileStatements; @@ -501,7 +501,7 @@ module T5Statements; INC(n); INC(i) until i = 11; - ASSERT(n = 10); + Assert(n = 10); end TestRepeatStatements; @@ -520,22 +520,22 @@ module T5Statements; for i := 1 to 10 do n := n + 1 end; - ASSERT(n = 10); + Assert(n = 10); n := 0; for i := 1 to 20 by 2 do n := n + 1 end; - ASSERT(n = 10); + Assert(n = 10); n := 0; for i := 20 to 1 by -2 do n := n + 1 end; - ASSERT(n = 10); + Assert(n = 10); globalInteger := 0; for i := 0 to IncGlobalIntegerReturnOne() do (*make sure the limit function is called three times*) x := x + 1.0 end; - ASSERT(globalInteger = 3) + Assert(globalInteger = 3) end TestForStatements; begin diff --git a/tests/obnc/passing/T5SystemStatements.obn b/tests/obnc/passing/T5SystemStatements.obn index 32c8d2a..847eccc 100644 --- a/tests/obnc/passing/T5SystemStatements.obn +++ b/tests/obnc/passing/T5SystemStatements.obn @@ -33,60 +33,60 @@ module T5SystemStatements; a, a1: Array; a2: array SYSTEM.SIZE(Array) + 1 of Int; begin - ASSERT(SYSTEM.SIZE(Int) = SYSTEM.SIZE(Pointer)); + Assert(SYSTEM.SIZE(Int) = SYSTEM.SIZE(Pointer)); (*ADR, PUT, GET*) b := true; SYSTEM.GET(SYSTEM.ADR(b), b1); - ASSERT(b1 = b); + Assert(b1 = b); SYSTEM.PUT(SYSTEM.ADR(b), false); - ASSERT(~b); + Assert(~b); ch := "a"; SYSTEM.GET(SYSTEM.ADR(ch), ch1); - ASSERT(ch1 = ch); + Assert(ch1 = ch); SYSTEM.PUT(SYSTEM.ADR(ch), "b"); - ASSERT(ch = "b"); + Assert(ch = "b"); SYSTEM.PUT(SYSTEM.ADR(ch), ch1); - ASSERT(ch = ch1); + Assert(ch = ch1); i := 1; SYSTEM.GET(SYSTEM.ADR(i), i1); - ASSERT(i1 = i); + Assert(i1 = i); SYSTEM.PUT(SYSTEM.ADR(i), 0); - ASSERT(i = 0); + Assert(i = 0); r := 1.0; SYSTEM.GET(SYSTEM.ADR(r), r1); - ASSERT(r1 = r); + Assert(r1 = r); SYSTEM.PUT(SYSTEM.ADR(r), 0.0); - ASSERT(r = 0.0); + Assert(r = 0.0); x := 1; SYSTEM.GET(SYSTEM.ADR(x), x1); - ASSERT(x1 = x); + Assert(x1 = x); SYSTEM.PUT(SYSTEM.ADR(x), 0); - ASSERT(x = 0); + Assert(x = 0); s := {0}; SYSTEM.GET(SYSTEM.ADR(s), s1); - ASSERT(s1 = s); + Assert(s1 = s); SYSTEM.PUT(SYSTEM.ADR(s), {}); - ASSERT(s = {}); + Assert(s = {}); (*BIT*) i := 1; - ASSERT(SYSTEM.BIT(SYSTEM.ADR(i), 0)); + Assert(SYSTEM.BIT(SYSTEM.ADR(i), 0)); i := 2; - ASSERT(~SYSTEM.BIT(SYSTEM.ADR(i), 0)); - ASSERT(SYSTEM.BIT(SYSTEM.ADR(i), 1)); + Assert(~SYSTEM.BIT(SYSTEM.ADR(i), 0)); + Assert(SYSTEM.BIT(SYSTEM.ADR(i), 1)); (*COPY*) a[0] := 1; a[1] := 2; SYSTEM.COPY(SYSTEM.ADR(a), SYSTEM.ADR(a1), 2); - ASSERT(a1[0] = 1); - ASSERT(a1[1] = 2); + Assert(a1[0] = 1); + Assert(a1[1] = 2); (*VAL*) xs[0] := 1; xs[1] := 2; SYSTEM.PUT(SYSTEM.ADR(xs), SYSTEM.VAL(Byte, 37)); - ASSERT(xs[0] = 37); - ASSERT(xs[1] = 2); + Assert(xs[0] = 37); + Assert(xs[1] = 2); (*silence "unused" compiler notifications*) x := byte; diff --git a/tests/obnc/passing/T6ProcedureDeclarations.obn b/tests/obnc/passing/T6ProcedureDeclarations.obn index f6c113a..268d0fd 100644 --- a/tests/obnc/passing/T6ProcedureDeclarations.obn +++ b/tests/obnc/passing/T6ProcedureDeclarations.obn @@ -51,8 +51,8 @@ module T6ProcedureDeclarations; procedure P3(A: Matrix); begin - ASSERT(LEN(A) = 10); - ASSERT(LEN(A[0]) = 20) + Assert(LEN(A) = 10); + Assert(LEN(A[0]) = 20) end P3; procedure P4(A: array of Row); @@ -60,7 +60,7 @@ module T6ProcedureDeclarations; begin P(0); - NEW(ptr); + New(ptr); P1(ptr); P2(proc); P3(A); @@ -75,14 +75,14 @@ module T6ProcedureDeclarations; procedure Alloc(var p: Ptr); begin - NEW(p); + New(p); p.f := 1 end Alloc; procedure P(var A: Matrix); begin - ASSERT(LEN(A) = 10); - ASSERT(LEN(A[0]) = 20) + Assert(LEN(A) = 10); + Assert(LEN(A[0]) = 20) end P; procedure Q(var x: T0); @@ -96,7 +96,7 @@ module T6ProcedureDeclarations; begin Alloc(x); - ASSERT(x.f = 1); + Assert(x.f = 1); P(A); y.f := 0; Q(y) @@ -114,7 +114,7 @@ module T6ProcedureDeclarations; var i: Int; begin for i := 0 to LEN(a) - 1 do - ASSERT(a[i] = i + 1) + Assert(a[i] = i + 1) end end P; @@ -127,7 +127,7 @@ module T6ProcedureDeclarations; c := 0; for i := 0 to LEN(M) - 1 do for j := 0 to LEN(M[0]) - 1 do - ASSERT(M[i, j] = c); + Assert(M[i, j] = c); INC(c) end end; @@ -138,7 +138,7 @@ module T6ProcedureDeclarations; begin c := LEN(row); for j := 0 to LEN(row) - 1 do - ASSERT(row[j] = c); + Assert(row[j] = c); INC(c) end end Inner1; @@ -156,7 +156,7 @@ module T6ProcedureDeclarations; for i := 0 to LEN(T) - 1 do for j := 0 to LEN(T[0]) - 1 do for k := 0 to LEN(T[0, 0]) - 1 do - ASSERT(T[i, j, k] = c); + Assert(T[i, j, k] = c); INC(c) end end @@ -199,7 +199,7 @@ module T6ProcedureDeclarations; type PtrExt = pointer to record (Ptr) end; var y: PtrExt; begin - NEW(y) + New(y) return y end P; @@ -229,7 +229,7 @@ module T6ProcedureDeclarations; begin s := Sum(10); - ASSERT(s = 55) + Assert(s = 55) end TestLocalProcedures; diff --git a/tests/obnc/passing/T7Modules.obn b/tests/obnc/passing/T7Modules.obn index 09b9526..9fc125f 100644 --- a/tests/obnc/passing/T7Modules.obn +++ b/tests/obnc/passing/T7Modules.obn @@ -44,41 +44,41 @@ module T7Modules; p1: ListExt; begin - ASSERT(A.boolConst); - ASSERT(A.charConst = CHR(22H)); - ASSERT(A.intConst = 1); - ASSERT(A.realConst = 2.3); - ASSERT(A.strConst = "hello there"); - ASSERT(A.nul = 0X); - ASSERT(A.lf = 0AX); - ASSERT(A.charMax = 0FFX); - ASSERT(A.setConst = {0, 2, 3, 5}); + Assert(A.boolConst); + Assert(A.charConst = CHR(22H)); + Assert(A.intConst = 1); + Assert(A.realConst = 2.3); + Assert(A.strConst = "hello there"); + Assert(A.nul = 0X); + Assert(A.lf = 0AX); + Assert(A.charMax = 0FFX); + Assert(A.setConst = {0, 2, 3, 5}); - ASSERT(A.boolVar = A.boolConst); - ASSERT(A.charVar = A.charConst); - ASSERT(A.intVar = A.intConst); - ASSERT(ABS(A.realVar - A.realConst) < 1.0E-6); - ASSERT(A.strVar = A.strConst); - ASSERT(A.setVar = A.setConst); - ASSERT(A.recVar.f = 1); + Assert(A.boolVar = A.boolConst); + Assert(A.charVar = A.charConst); + Assert(A.intVar = A.intConst); + Assert(ABS(A.realVar - A.realConst) < 1.0E-6); + Assert(A.strVar = A.strConst); + Assert(A.setVar = A.setConst); + Assert(A.recVar.f = 1); intVar := A.intVar; A.procVar(A.strVar); - NEW(y.f); + New(y.f); y.f.f := 1; w := x; A.Q(x); - NEW(list); + New(list); A.R(matrix); x0 := x1; A.S(t); A.S1(p); - ASSERT(D.b); - ASSERT(E.b); - ASSERT(T7Modules.b); - ASSERT(lib1M.b); - ASSERT(OBNC.b); + Assert(D.b); + Assert(E.b); + Assert(T7Modules.b); + Assert(lib1M.b); + Assert(OBNC.b); p1 := nil end T7Modules.