diff options
author | rubidium <rubidium@openttd.org> | 2010-07-16 17:42:58 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-07-16 17:42:58 +0000 |
commit | 92da292fbc3fe4a3c2c7c124168fa77653210b53 (patch) | |
tree | 28aadd607f11b560e2471ef8dfbea6ce9e6ae876 /bin | |
parent | 50c7f60eca6da0f710084da9d4ecf1ae9217498b (diff) | |
download | openttd-92da292fbc3fe4a3c2c7c124168fa77653210b53.tar.xz |
(svn r20162) -Fix [FS#3954]: integer comparison failed in case the difference was more than "MAX_UINT"/2
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ai/regression/regression.nut | 44 | ||||
-rw-r--r-- | bin/ai/regression/regression.txt | 33 |
2 files changed, 77 insertions, 0 deletions
diff --git a/bin/ai/regression/regression.nut b/bin/ai/regression/regression.nut index 7dc35e1de..2d3db61a5 100644 --- a/bin/ai/regression/regression.nut +++ b/bin/ai/regression/regression.nut @@ -1757,6 +1757,48 @@ function Regression::PrintSubsidy(subsidy_id) print(" GetCargoType(): " + AISubsidy.GetCargoType(subsidy_id)); } +function Regression::Math() +{ + print(""); + print("--Math--"); + print(" -2147483648 < -2147483647: " + (-2147483648 < -2147483647)); + print(" -2147483648 < -1 : " + (-2147483648 < -1 )); + print(" -2147483648 < 0 : " + (-2147483648 < 0 )); + print(" -2147483648 < 1 : " + (-2147483648 < 1 )); + print(" -2147483648 < 2147483647: " + (-2147483648 < 2147483647)); + + print(" -2147483647 < -2147483648: " + (-2147483647 < -2147483648)); + print(" -1 < -2147483648: " + (-1 < -2147483648)); + print(" 0 < -2147483648: " + ( 0 < -2147483648)); + print(" 1 < -2147483648: " + ( 1 < -2147483648)); + print(" 2147483647 < -2147483648: " + ( 2147483647 < -2147483648)); + + print(" -1 > 2147483647: " + (-1 > 2147483647)); + print(" -1 > 1 : " + (-1 > 1 )); + print(" -1 > 0 : " + (-1 > 0 )); + print(" -1 > -1 : " + (-1 > -1 )); + print(" -1 > -2147483648: " + (-1 > -2147483648)); + + print(" 1 > 2147483647: " + ( 1 > 2147483647)); + print(" 1 > 1 : " + ( 1 > 1 )); + print(" 1 > 0 : " + ( 1 > 0 )); + print(" 1 > -1 : " + ( 1 > -1 )); + print(" 1 > -2147483648: " + ( 1 > -2147483648)); + + print(" 2147483647 > 2147483646: " + ( 2147483647 > 2147483646)); + print(" 2147483647 > 1 : " + ( 2147483647 > 1 )); + print(" 2147483647 > 0 : " + ( 2147483647 > 0 )); + print(" 2147483647 > -1 : " + ( 2147483647 > -1 )); + print(" 2147483647 > -2147483648: " + ( 2147483647 > -2147483648)); + + print(" 2147483646 > 2147483647: " + ( 2147483646 > 2147483647)); + print(" 1 > 2147483647: " + ( 1 > 2147483647)); + print(" 0 > 2147483647: " + ( 0 > 2147483647)); + print(" -1 > 2147483647: " + (-1 > 2147483647)); + print(" -2147483648 > 2147483647: " + (-2147483648 > 2147483647)); + + print(" 13725 > -2147483648: " + ( 13725 > -2147483648)); +} function Regression::Start() { @@ -1822,5 +1864,7 @@ function Regression::Start() } } print(" IsEventWaiting: false"); + + this.Math(); } diff --git a/bin/ai/regression/regression.txt b/bin/ai/regression/regression.txt index ced0878c5..524341fc8 100644 --- a/bin/ai/regression/regression.txt +++ b/bin/ai/regression/regression.txt @@ -8632,4 +8632,37 @@ ERROR: IsEnd() is invalid as Begin() is never called GetEventType: 6 Unknown Event IsEventWaiting: false + +--Math-- + -2147483648 < -2147483647: true + -2147483648 < -1 : true + -2147483648 < 0 : true + -2147483648 < 1 : true + -2147483648 < 2147483647: true + -2147483647 < -2147483648: false + -1 < -2147483648: false + 0 < -2147483648: false + 1 < -2147483648: false + 2147483647 < -2147483648: false + -1 > 2147483647: false + -1 > 1 : false + -1 > 0 : false + -1 > -1 : false + -1 > -2147483648: true + 1 > 2147483647: false + 1 > 1 : false + 1 > 0 : true + 1 > -1 : true + 1 > -2147483648: true + 2147483647 > 2147483646: true + 2147483647 > 1 : true + 2147483647 > 0 : true + 2147483647 > -1 : true + 2147483647 > -2147483648: true + 2147483646 > 2147483647: false + 1 > 2147483647: false + 0 > 2147483647: false + -1 > 2147483647: false + -2147483648 > 2147483647: false + 13725 > -2147483648: true ERROR: The AI died unexpectedly. |