diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-10-01 17:24:37 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-10-01 17:24:37 -0300 |
| commit | b2a580bdb1982e45bb37f95b78c2dafec6efa7a6 (patch) | |
| tree | 76de58214adff838a26346514a8a6fba459bde9b /testes | |
| parent | 89f6a85f034b2535e43e421991098fa05a92cd60 (diff) | |
| download | lua-b2a580bdb1982e45bb37f95b78c2dafec6efa7a6.tar.gz lua-b2a580bdb1982e45bb37f95b78c2dafec6efa7a6.tar.bz2 lua-b2a580bdb1982e45bb37f95b78c2dafec6efa7a6.zip | |
Janitorial work
- Several details in 'lcode.c'
- A few more tests for code generation
- Bug in assert in 'lcode.c' ("=" x "==")
- Comments in 'lopcodes.h' and 'ltable.c'
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/code.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/testes/code.lua b/testes/code.lua index ab531fa8..e12f3f91 100644 --- a/testes/code.lua +++ b/testes/code.lua | |||
| @@ -306,8 +306,10 @@ checkR(function (x) return x // 1 end, 10.0, 10.0, | |||
| 306 | checkR(function (x) return x % (100 - 10) end, 91, 1, | 306 | checkR(function (x) return x % (100 - 10) end, 91, 1, |
| 307 | 'MODK', 'MMBINK', 'RETURN1') | 307 | 'MODK', 'MMBINK', 'RETURN1') |
| 308 | checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'MMBINI', 'RETURN1') | 308 | checkR(function (x) return k1 << x end, 3, 8, 'SHLI', 'MMBINI', 'RETURN1') |
| 309 | checkR(function (x) return x << 2 end, 10, 40, 'SHRI', 'MMBINI', 'RETURN1') | 309 | checkR(function (x) return x << 127 end, 10, 0, 'SHRI', 'MMBINI', 'RETURN1') |
| 310 | checkR(function (x) return x >> 2 end, 8, 2, 'SHRI', 'MMBINI', 'RETURN1') | 310 | checkR(function (x) return x << -127 end, 10, 0, 'SHRI', 'MMBINI', 'RETURN1') |
| 311 | checkR(function (x) return x >> 128 end, 8, 0, 'SHRI', 'MMBINI', 'RETURN1') | ||
| 312 | checkR(function (x) return x >> -127 end, 8, 0, 'SHRI', 'MMBINI', 'RETURN1') | ||
| 311 | checkR(function (x) return x & 1 end, 9, 1, 'BANDK', 'MMBINK', 'RETURN1') | 313 | checkR(function (x) return x & 1 end, 9, 1, 'BANDK', 'MMBINK', 'RETURN1') |
| 312 | checkR(function (x) return 10 | x end, 1, 11, 'BORK', 'MMBINK', 'RETURN1') | 314 | checkR(function (x) return 10 | x end, 1, 11, 'BORK', 'MMBINK', 'RETURN1') |
| 313 | checkR(function (x) return -10 ~ x end, -1, 9, 'BXORK', 'MMBINK', 'RETURN1') | 315 | checkR(function (x) return -10 ~ x end, -1, 9, 'BXORK', 'MMBINK', 'RETURN1') |
| @@ -331,6 +333,7 @@ check(function () return k3/0 end, 'LOADI', 'DIVK', 'MMBINK', 'RETURN1') | |||
| 331 | check(function () return 0%0 end, 'LOADI', 'MODK', 'MMBINK', 'RETURN1') | 333 | check(function () return 0%0 end, 'LOADI', 'MODK', 'MMBINK', 'RETURN1') |
| 332 | check(function () return -4//0 end, 'LOADI', 'IDIVK', 'MMBINK', 'RETURN1') | 334 | check(function () return -4//0 end, 'LOADI', 'IDIVK', 'MMBINK', 'RETURN1') |
| 333 | check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'MMBIN', 'RETURN1') | 335 | check(function (x) return x >> 2.0 end, 'LOADF', 'SHR', 'MMBIN', 'RETURN1') |
| 336 | check(function (x) return x << 128 end, 'LOADI', 'SHL', 'MMBIN', 'RETURN1') | ||
| 334 | check(function (x) return x & 2.0 end, 'LOADF', 'BAND', 'MMBIN', 'RETURN1') | 337 | check(function (x) return x & 2.0 end, 'LOADF', 'BAND', 'MMBIN', 'RETURN1') |
| 335 | 338 | ||
| 336 | -- basic 'for' loops | 339 | -- basic 'for' loops |
