Commit 5d86c7c2f0
Verified · cmc
Layout: unified · split
Tests/OrgCoreTests/CalcTests.swift +3 −2
| @@ -244,7 +244,8 @@ struct CalcTests { | |||
| 244 | let ours: String | 244 | let ours: String |
| 245 | do { ours = try Calc.evaluate(c.0, modes: modes) } catch { ours = "unsupported: \(error)" } | 245 | do { ours = try Calc.evaluate(c.0, modes: modes) } catch { ours = "unsupported: \(error)" } |
| 246 | if ours.hasPrefix("unsupported") { | 246 | if ours.hasPrefix("unsupported") { |
| 247 | skipped.append(c.0) | 247 | // Calc can fail too, e.g. a root whose Newton steps never settle. |
| 248 | if !expected.hasPrefix("LISP ERROR") { skipped.append(c.0) } | ||
| 248 | continue | 249 | continue |
| 249 | } | 250 | } |
| 250 | #expect(ours == expected, "\(c.0) \(c.1) p\(precision)") | 251 | #expect(ours == expected, "\(c.0) \(c.1) p\(precision)") |
| @@ -322,7 +323,7 @@ struct CalcTests { | |||
| 322 | "8^(1:3)", "1.5^3"].map { ($0, "(float 0)") } | 323 | "8^(1:3)", "1.5^3"].map { ($0, "(float 0)") } |
| 323 | if precision <= 14 { | 324 | if precision <= 14 { |
| 324 | cases += ["sqrt(2)", "sinh(1)", "log(10,2)", "nroot(10,3)", "vgmean([1,2,3])", "exp(1)", "sin(30)", "2^0.5", | 325 | cases += ["sqrt(2)", "sinh(1)", "log(10,2)", "nroot(10,3)", "vgmean([1,2,3])", "exp(1)", "sin(30)", "2^0.5", |
| 325 | "exp(1.58)", "ln(9.44)", "0.08^1.5", "0.11^1.5", "exp(8.44)", "pow(2.5,1:3)"].map { ($0, "(float 0)") } | 326 | "exp(1.58)", "ln(9.44)", "0.08^1.5", "0.11^1.5", "exp(8.44)", "pow(2.5,1:3)", "(599e-2)^(5:7)"].map { ($0, "(float 0)") } |
| 326 | // exp, ln and powers round at two digits more first. | 327 | // exp, ln and powers round at two digits more first. |
| 327 | for _ in 0..<150 { | 328 | for _ in 0..<150 { |
| 328 | let x = "\(Int.random(in: 1...999, using: &generator))e-2" | 329 | let x = "\(Int.random(in: 1...999, using: &generator))e-2" |