mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
443903aa00
# What's changed? * Luau allocation scheme was changed to handle allocations in 513-1024 byte range internally without falling back to global allocator * coroutine/thread creation no longer requires any global allocations, making it up to 15% faster (vs libc malloc) * table construction for 17-32 keys or 33-64 array elements is up to 30% faster (vs libc malloc) ### New Type Solver * Cyclic unary negation type families are reduced to `number` when possible * Class types are skipped when searching for free types in unifier to improve performance * Fixed issues with table type inference when metatables are present * Improved inference of iteration loop types * Fixed an issue with bidirectional inference of method calls * Type simplification will now preserve error suppression markers ### Native Code Generation * Fixed TAG_VECTOR skip optimization to not break instruction use counts (broken optimization wasn't included in 614) * Fixed missing side-effect when optimizing generic loop preparation instruction --- ### Internal Contributors Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com> --------- Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Alexander McCord <amccord@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Vighnesh <vvijay@roblox.com> Co-authored-by: Aviral Goel <agoel@roblox.com> Co-authored-by: David Cope <dcope@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com>
40 lines
1.4 KiB
Lua
40 lines
1.4 KiB
Lua
local function describe(phrase, callback) end
|
|
local function it(phrase, callback) end
|
|
local function expect(value) end
|
|
|
|
return function()
|
|
local HashLib = require(script.Parent)
|
|
local sha256 = HashLib.sha256
|
|
|
|
describe("HashLib.sha256", function()
|
|
it("should properly encode strings", function()
|
|
expect(sha256("abc").to.equal("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"))
|
|
expect(
|
|
sha256("The quick brown fox jumps over the lazy dog").to.equal(
|
|
"d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592"
|
|
)
|
|
)
|
|
expect(sha256("123456").to.equal("8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92"))
|
|
end)
|
|
|
|
it("should create a private closure that works", function()
|
|
local AppendNextChunk = sha256()
|
|
AppendNextChunk("The quick brown fox")
|
|
AppendNextChunk(" jumps ")
|
|
AppendNextChunk("") -- chunk may be an empty string
|
|
AppendNextChunk("over the lazy dog")
|
|
expect(AppendNextChunk()).to.equal("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592")
|
|
end)
|
|
|
|
it("should allow the private closure to work if called twice", function()
|
|
local AppendNextChunk = sha256()
|
|
AppendNextChunk("The quick brown fox")
|
|
AppendNextChunk(" jumps ")
|
|
AppendNextChunk("") -- chunk may be an empty string
|
|
AppendNextChunk("over the lazy dog")
|
|
AppendNextChunk()
|
|
expect(AppendNextChunk()).to.equal("d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592")
|
|
end)
|
|
end)
|
|
end
|