diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:19:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:07:37 +0000 |
commit | b485aab7e71c1625cfc27e0f92c9509f42378458 (patch) | |
tree | ae9abe108601079d1679194de237c9a435ae5b55 /web/server/h2o/libh2o/deps/mruby/test/t/lang.rb | |
parent | Adding upstream version 1.44.3. (diff) | |
download | netdata-b485aab7e71c1625cfc27e0f92c9509f42378458.tar.xz netdata-b485aab7e71c1625cfc27e0f92c9509f42378458.zip |
Adding upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/deps/mruby/test/t/lang.rb')
-rwxr-xr-x | web/server/h2o/libh2o/deps/mruby/test/t/lang.rb | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/web/server/h2o/libh2o/deps/mruby/test/t/lang.rb b/web/server/h2o/libh2o/deps/mruby/test/t/lang.rb deleted file mode 100755 index 57c375643..000000000 --- a/web/server/h2o/libh2o/deps/mruby/test/t/lang.rb +++ /dev/null @@ -1,74 +0,0 @@ -# The aim of these tests is to detect pitfall for optimized VM.
-
-# Test for or/and
-#
-# You may think instruction fusion(OP_EQ and OP_JMPIF) for avoiding
-# generate intermediate boolean value.
-# But and/or is pitfall for this fusioning.
-#
-# For example, the following mruby code:
-#
-# if i > 0 and i < 10 then
-#
-# compiles to the following byte code:
-#
-# 1 000 OP_LOADI R1 0 ; R1:i
-# 2 001 OP_MOVE R2 R1 ; R1:i
-# 2 002 OP_LOADI R3 0
-# 2 003 OP_GT R2 :> 1
-# 2 004 OP_JMPNOT R2 008
-# 2 005 OP_MOVE R2 R1 ; R1:i
-# 2 006 OP_LOADI R3 10
-# 2 007 OP_LT R2 :< 1
-# 2 008 OP_JMPNOT R2 (The address of end of then part)
-#
-# When the instruction fusion the OP_GT and OP_JMPNOT you fell into the pitfalls.
-# The deleted intermediate boolean value is used in OP_JMPNOT (address 008).
-
-assert('and', '11.2.3') do
- a = 1
- if a > 0 and a < 10 then
- b = 1
- else
- b = 0
- end
- assert_equal 1, b
-
- if a < 0 and a < 10 then
- b = 1
- else
- b = 0
- end
- assert_equal 0, b
-
- if a < 0 and a > 10 then
- b = 1
- else
- b = 0
- end
- assert_equal 0, b
-end
-
-assert('or','11.2.4') do
- a = 1
- if a > 0 or a < 10 then
- b = 1
- else
- b = 0
- end
- assert_equal 1, b
-
- if a < 0 or a < 10 then
- b = 1
- else
- b = 0
- end
- assert_equal 1, b
-
- if a < 0 or a > 10 then
- b = 1
- else
- b = 0
- end
- assert_equal 0, b
-end
|