diff --git a/Package.resolved b/Package.resolved index fce112b..ee26df8 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-case-paths", "state" : { - "revision" : "fc45e7b2cfece9dd80b5a45e6469ffe67fe67984", - "version" : "0.14.1" + "revision" : "b871e5ed11a23e52c2896a92ce2c829982ff8619", + "version" : "1.4.2" } }, { @@ -32,8 +32,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-parsing", "state" : { - "revision" : "27c941bbd22a4bbc53005a15a0440443fd892f70", - "version" : "0.12.1" + "revision" : "a0e7d73f462c1c38c59dc40a3969ac40cea42950", + "version" : "0.13.0" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-syntax", + "state" : { + "revision" : "303e5c5c36d6a558407d364878df131c3546fad8", + "version" : "510.0.2" } }, { @@ -41,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", "state" : { - "revision" : "4af50b38daf0037cfbab15514a241224c3f62f98", - "version" : "0.8.5" + "revision" : "6f30bdba373bbd7fbfe241dddd732651f2fbd1e2", + "version" : "1.1.2" } } ], diff --git a/Tests/MathParserTests/MathParserTests.swift b/Tests/MathParserTests/MathParserTests.swift index 833b746..c2552e1 100644 --- a/Tests/MathParserTests/MathParserTests.swift +++ b/Tests/MathParserTests/MathParserTests.swift @@ -668,4 +668,27 @@ error: unexpected input XCTAssertEqual(cos(Double.pi / 3), parser.parse("cos(60)")?.value) XCTAssertEqual(atan2(1.0, 1.0) * 180.0 / Double.pi, parser.parse("atan2(1.0, 1.0)")?.value) } + + func testMod() { + XCTAssertEqual(5.truncatingRemainder(dividingBy: 3), parser.parse("mod(5, 3)")?.value) + XCTAssertEqual(3.truncatingRemainder(dividingBy: 5), parser.parse("mod(3, 5)")?.value) + XCTAssertEqual(55.truncatingRemainder(dividingBy: 3), parser.parse("mod(55, 3)")?.value) + XCTAssertEqual(35.truncatingRemainder(dividingBy: 5), parser.parse("mod(35, 5)")?.value) + + XCTAssertEqual(-2, parser.parse("mod(-5, 3)")?.value) + XCTAssertEqual(-3, parser.parse("mod(-3, 5)")?.value) + XCTAssertEqual(-1, parser.parse("mod(-55, 3)")?.value) + XCTAssertEqual(0, parser.parse("mod(-35, 5)")?.value) + + XCTAssertEqual(2, parser.parse("mod(5, -3)")?.value) + XCTAssertEqual(3, parser.parse("mod(3, -5)")?.value) + XCTAssertEqual(1, parser.parse("mod(55, -3)")?.value) + XCTAssertEqual(0, parser.parse("mod(35, -5)")?.value) + + XCTAssertEqual(-2, parser.parse("mod(-5, -3)")?.value) + XCTAssertEqual(-3, parser.parse("mod(-3, -5)")?.value) + XCTAssertEqual(-1, parser.parse("mod(-55, -3)")?.value) + XCTAssertEqual(0, parser.parse("mod(-35, -5)")?.value) + } } +