Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucteo committed Dec 7, 2024
1 parent f20f872 commit 71c6d2a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Tests/HyloTests/BuiltinFunctionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,30 @@ final class BuiltinFunctionTests: XCTestCase {
createInstanceWithType: expectedType)
}

func testAtomicLoad() throws {
let expectedType = ArrowType(.builtin(.ptr), to: .builtin(.i(64)))
try assertParse(
instructions: ["atomic_load"],
parameterizedBy: [
["relaxed", "i64"],
["acquire", "i64"],
["seqcst", "i64"]
],
createInstanceWithType: expectedType)
}

func testAtomicStore() throws {
let expectedType = ArrowType(.builtin(.ptr), .builtin(.i(64)), to: .builtin(.ptr))
try assertParse(
instructions: ["atomic_store"],
parameterizedBy: [
["relaxed", "i64"],
["release", "i64"],
["seqcst", "i64"]
],
createInstanceWithType: expectedType)
}

/// For each element in `instructions` and `parameters`, assert that parsing a built-in functions
/// named after their concatenation creates an instance with the same stem and parameters, and
/// whose type is `expectedType`.
Expand Down

0 comments on commit 71c6d2a

Please sign in to comment.