Skip to content

Commit 6d16b9d

Browse files
tomasfclaude
andcommitted
Rename test functions to use descriptive backtick names
Use Swift's backtick syntax for test function names to improve readability in test output. Names now describe what each test verifies rather than using abbreviated identifiers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6f770a7 commit 6d16b9d

30 files changed

Lines changed: 100 additions & 109 deletions

Tests/Tests/2D.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Testing
22
@testable import Cadova
33

44
struct Geometry2DTests {
5-
@Test func basic2D() async throws {
5+
@Test func `2D boolean operations produce correct geometry`() async throws {
66
try await Union {
77
Rectangle(Vector2D(30, 10))
88
.aligned(at: .centerY)
@@ -19,7 +19,7 @@ struct Geometry2DTests {
1919
.expectEquals(goldenFile: "2d/basics")
2020
}
2121

22-
@Test func circular() async throws {
22+
@Test func `circular shapes and overhang methods work correctly`() async throws {
2323
try await Union {
2424
Circle(diameter: 8)
2525
.scaled(x: 2)
@@ -40,7 +40,7 @@ struct Geometry2DTests {
4040
.expectEquals(goldenFile: "2d/circular")
4141
}
4242

43-
@Test func roundedRectangle() async throws {
43+
@Test func `rectangle corners can be rounded with edge profiles`() async throws {
4444
try await Rectangle(x: 10, y: 10)
4545
.cuttingEdgeProfile(.fillet(radius: 5), on: .bottomLeft)
4646
.cuttingEdgeProfile(.fillet(radius: 3), on: .bottomRight)

Tests/Tests/3D.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Testing
33
@testable import Cadova
44

55
struct Geometry3DTests {
6-
@Test func basic3D() async throws {
6+
@Test func `3D boolean operations produce correct geometry`() async throws {
77
try await Box([20, 20, 20])
88
.aligned(at: .center)
99
.intersecting {
@@ -17,14 +17,14 @@ struct Geometry3DTests {
1717
.expectEquals(goldenFile: "3d/basics")
1818
}
1919

20-
@Test func empty3D() async throws {
20+
@Test func `empty boolean operations have no effect`() async throws {
2121
try await Box([10, 20, 30])
2222
.subtracting {}
2323
.adding {}
2424
.expectEquals(goldenFile: "3d/empty")
2525
}
2626

27-
@Test func roundedBoxes() async throws {
27+
@Test func `box corners and edges can be rounded`() async throws {
2828
try await Stack(.x, spacing: 1) {
2929
Box([10, 8, 5])
3030
.roundingBoxCorners(radius: 2)
@@ -39,7 +39,7 @@ struct Geometry3DTests {
3939
.expectEquals(goldenFile: "3d/rounded-box")
4040
}
4141

42-
@Test func cylinders() async throws {
42+
@Test func `cylinders support various dimension specifications`() async throws {
4343
try await Stack(.y, spacing: 1) {
4444
Cylinder(bottomRadius: 3, topRadius: 6, height: 10)
4545
Cylinder(largerDiameter: 10, apexAngle: 10°, height: 20)

Tests/Tests/Anchors.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Testing
22
@testable import Cadova
33

44
struct AnchorTests {
5-
@Test func anchor() async throws {
5+
@Test func `geometry can be positioned at an anchor point`() async throws {
66
let boxRightSide = Anchor("right side of box")
77

88
let geometry = Stack(.z, alignment: .center) {
@@ -21,7 +21,7 @@ struct AnchorTests {
2121
#expect(try await geometry.bounds .init(minimum: [-5, -5, 0], maximum: [15, 5, 14]))
2222
}
2323

24-
@Test func multipleDefinitions() async throws {
24+
@Test func `anchor can be defined at multiple points on a shape`() async throws {
2525
let sphereSurface = Anchor("sphere's surface")
2626

2727
let geometry = Box(1)
@@ -44,7 +44,7 @@ struct AnchorTests {
4444
#expect(try await geometry.bounds .init(minimum: .zero, maximum: [14, 14, 15]))
4545
}
4646

47-
@Test func usedBeforeDefinition() async throws {
47+
@Test func `anchor can be used before it is defined`() async throws {
4848
let rightAnchor = Anchor("sphere's right side")
4949

5050
let geometry = Box(1)

Tests/Tests/BezierCurve.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Testing
22
@testable import Cadova
33

44
struct BezierCurveTests {
5-
@Test func quadraticCurvePoints() {
5+
@Test func `quadratic curve generates correct sample points`() {
66
let curve = BezierPath2D.Curve(controlPoints: [
77
[2.5, 8], [19.3, 25], [27, 10]
88
])
@@ -11,7 +11,7 @@ struct BezierCurveTests {
1111
#expect(points [[2.5, 8], [5.769, 11.08], [8.856, 13.52], [11.761, 15.32], [14.484, 16.48], [17.025, 17], [19.384, 16.88], [21.561, 16.12], [23.556, 14.72], [25.369, 12.68], [27, 10]])
1212
}
1313

14-
@Test func cubicCurvePoints() {
14+
@Test func `cubic curve generates correct sample points`() {
1515
let curve = BezierPath2D.Curve(controlPoints: [
1616
[12.5, 8], [19.3, 25], [30.2, 12], [27, 10]
1717
])
@@ -20,7 +20,7 @@ struct BezierCurveTests {
2020
#expect(points [[12.5, 8], [14.6448, 12.241], [16.9264, 14.928], [19.2356, 16.307], [21.4632, 16.624], [23.5, 16.125], [25.2368, 15.056], [26.5644, 13.663], [27.3736, 12.192], [27.5552, 10.889], [27, 10]])
2121
}
2222

23-
@Test func quartic3DCurvePoints() {
23+
@Test func `quartic 3D curve generates correct sample points`() {
2424
let curve = BezierPath3D.Curve(controlPoints: [
2525
[11, 12.5, 8], [19.3, 56, 25], [30.2, 41.5, 12], [-12, 3.5, 20], [19, 27, 10]
2626
])

Tests/Tests/BezierPatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Testing
22
@testable import Cadova
33

44
struct BezierPatchTests {
5-
@Test func basic() async throws {
5+
@Test func `bezier patch can be enclosed into solid geometry`() async throws {
66
let patch = BezierPatch(controlPoints: [
77
[ [0, 0, 0], [1, 0, 0.8], [2, 0, -0.2], [3, 0, 0] ],
88
[ [0, 1, 0.5], [1, 1, 1.5], [2, 1, 0.3], [3, 1, -0.4] ],

Tests/Tests/BezierPath.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ struct BezierPathTests {
1414
linearPath = BezierPath3D(linesBetween: linearPoints)
1515
}
1616

17-
@Test func quadraticPointsFixed() {
17+
@Test func `quadratic path with fixed segmentation produces correct points`() {
1818
let points = quadraticPath.points(segmentation: .fixed(5))
1919
#expect(points [[39.1, 150], [31.456, 133.6], [23.724, 160.4], [15.904, 230.4], [7.996, 343.6], [0, 500], [118.12, 346.336], [216.48, 219.504], [295.08, 119.504], [353.92, 46.336], [393, 0]])
2020
}
2121

22-
@Test func quadraticPointsDynamic() {
22+
@Test func `quadratic path with adaptive segmentation produces correct points`() {
2323
let points = quadraticPath.points(segmentation: .adaptive(minAngle: 10°, minSize: 20))
2424

2525
#expect(points [[39.1, 150], [34.3328, 134.688], [29.5312, 136.25], [24.6953, 154.688], [22.2645, 170.234], [19.825, 190], [18.6021, 201.465], [17.377, 213.984], [16.1497, 227.559], [14.9203, 242.188], [13.6888, 257.871], [12.4551, 274.609], [11.2192, 292.402], [9.98125, 311.25], [8.74111, 331.152], [8.12024, 341.499], [7.49883, 352.109], [6.87688, 362.983], [6.25439, 374.121], [5.63137, 385.522], [5.00781, 397.188], [4.38372, 409.116], [3.75908, 421.309], [3.13391, 433.765], [2.5082, 446.484], [1.88196, 459.468], [1.25518, 472.715], [0.627856, 486.226], [0, 500], [9.9397, 487.029], [19.7588, 474.221], [29.4573, 461.578], [39.0352, 449.098], [48.4924, 436.781], [57.8291, 424.629], [67.0452, 412.64], [76.1406, 400.816], [85.1155, 389.155], [93.9697, 377.657], [102.703, 366.324], [111.316, 355.154], [119.809, 344.148], [128.181, 333.306], [136.432, 322.627], [144.562, 312.112], [152.573, 301.762], [160.462, 291.574], [168.231, 281.551], [175.879, 271.691], [183.406, 261.996], [190.813, 252.463], [198.1, 243.095], [205.266, 233.891], [212.311, 224.85], [219.235, 215.973], [226.039, 207.26], [232.723, 198.71], [239.285, 190.324], [245.728, 182.103], [252.049, 174.044], [258.25, 166.15], [270.29, 150.853], [281.848, 136.21], [292.923, 122.223], [303.516, 108.891], [313.626, 96.2135], [323.254, 84.1914], [332.399, 72.8244], [341.062, 62.1125], [349.243, 52.0557], [356.941, 42.6539], [364.157, 33.9072], [370.891, 25.8156], [382.91, 11.5977], [393, 0]])
2626
}
2727

28-
@Test func circle() async throws {
28+
@Test func `circular arc produces correct control points and area`() async throws {
2929
let path = BezierPath2D(startPoint: [10, 0])
3030
.addingArc(center: .zero, to: 360°, clockwise: false)
3131

@@ -43,7 +43,7 @@ struct BezierPathTests {
4343
#expect(floor(m.area) 314)
4444
}
4545

46-
@Test func arc() async throws {
46+
@Test func `partial arc produces correct control points and bounds`() async throws {
4747
let path = BezierPath2D(startPoint: [10, 0])
4848
.addingArc(center: [1, 2], to: 100°, clockwise: false)
4949

Tests/Tests/BezierPathBuilder.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Testing
22
@testable import Cadova
33

44
struct BezierPathBuilderTests {
5-
@Test func testAbsolute() {
5+
@Test func `builder with absolute coordinates matches manual construction`() {
66
let builderPath = BezierPath2D(from: [10, 4]) {
77
line(x: 22, y: 1)
88
line(x: 2)
@@ -30,7 +30,7 @@ struct BezierPathBuilderTests {
3030
#expect(builderPath ≈ manualPath)
3131
}
3232

33-
@Test func relativeArc() async throws {
33+
@Test func `builder supports relative arc commands`() async throws {
3434
let builderPath = BezierPath2D(from: [-5, 0], mode: .relative) {
3535
line(y: 10)
3636
clockwiseArc(centerX: 5, angle: 180°)
@@ -45,7 +45,7 @@ struct BezierPathBuilderTests {
4545
#expect(builderPath manualPath)
4646
}
4747

48-
@Test func testRelative() {
48+
@Test func `builder with relative coordinates matches manual construction`() {
4949
let builderPath = BezierPath2D(from: [10, 4], mode: .relative) {
5050
line(x: 22, y: 1)
5151
line(x: 2)

Tests/Tests/Bounds.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ import Testing
22
@testable import Cadova
33

44
struct BoundsTests {
5-
@Test func basicAlignment2D() async throws {
5+
@Test func `2D shape alignment affects bounds`() async throws {
66
let geometry = Rectangle([10, 4])
77
.aligned(at: .centerX, .top)
88

99
#expect(try await geometry.bounds .init(minimum: [-5, -4], maximum: [5, 0]))
1010
}
1111

12-
@Test func conflictingAlignment() async throws {
12+
@Test func `conflicting alignments are resolved left to right`() async throws {
1313
let geometry = Rectangle([50, 20])
1414
.aligned(at: .minX, .centerX, .centerY, .maxX)
1515

1616
#expect(try await geometry.bounds .init(minimum: [-50, -10], maximum: [0, 10]))
1717
}
1818

19-
@Test func repeatedAlignment() async throws {
19+
@Test func `repeated alignments accumulate correctly`() async throws {
2020
let geometry = Box([10, 8, 12])
2121
.aligned(at: .minX)
2222
.aligned(at: .maxY)
@@ -27,7 +27,7 @@ struct BoundsTests {
2727
#expect(try await geometry.bounds .init(minimum: [-5, -4, 0], maximum: [5, 4, 12]))
2828
}
2929

30-
@Test func transformedBounds() async throws {
30+
@Test func `bounds are correctly calculated after transforms`() async throws {
3131
let base = Box([10, 8, 12])
3232
.rotated(x: 90°)
3333
.translated(y: 12)
@@ -40,7 +40,7 @@ struct BoundsTests {
4040
#expect(try await extended.bounds .init(minimum: .zero, maximum: [28, 12, 10]))
4141
}
4242

43-
@Test func stack() async throws {
43+
@Test func `stack computes combined bounds of children`() async throws {
4444
let geometry = Stack(.x, spacing: 1, alignment: .min) {
4545
Box([10, 8, 12])
4646
RegularPolygon(sideCount: 8, apothem: 3)

Tests/Tests/Cache.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct GeometryCacheTests {
77
let sphere = Sphere(diameter: 1)
88
let box = Box(4)
99

10-
@Test func basics() async throws {
10+
@Test func `cache stores and reuses evaluation results`() async throws {
1111
_ = try await context.concrete(for: sphere)
1212
await #expect(context.cache3D.count == 1)
1313

@@ -20,15 +20,15 @@ struct GeometryCacheTests {
2020
await #expect(context.cache3D.count == 3)
2121
}
2222

23-
@Test func differentEnvironments() async throws {
23+
@Test func `different environments produce separate cache entries`() async throws {
2424
_ = try await context.concrete(for: sphere)
2525
await #expect(context.cache3D.count == 1)
2626

2727
_ = try await context.concrete(for: sphere, in: .defaultEnvironment.withSegmentation(.fixed(10)))
2828
await #expect(context.cache3D.count == 2)
2929
}
3030

31-
@Test func warp() async throws {
31+
@Test func `warp operations with same parameters share cache`() async throws {
3232
let scale = 2.0
3333
let warp1 = box.warped(operationName: "test", cacheParameters: scale) {
3434
Vector3D($0.x + $0.z * scale, $0.y, $0.z)
@@ -48,7 +48,7 @@ struct GeometryCacheTests {
4848
await #expect(context.cache3D.count == 2)
4949
}
5050

51-
@Test func split() async throws {
51+
@Test func `split operation creates expected cache entries`() async throws {
5252
await #expect(context.cache3D.count == 0)
5353

5454
let split1 = box.split(along: .z(2).rotated(x: 10°)) { g1, g2 in
@@ -59,8 +59,7 @@ struct GeometryCacheTests {
5959
await #expect(context.cache3D.count == 4) // box, 2x trims, split union
6060
}
6161

62-
// CachedConcreteTransformer should preserve elements
63-
@Test func hullPreservesParts() async throws {
62+
@Test func `convex hull preserves part information`() async throws {
6463
let model = Sphere(diameter: 10)
6564
.convexHull(adding: [0, 0, 20])
6665
.adding {
@@ -73,8 +72,7 @@ struct GeometryCacheTests {
7372
#expect(partNames == ["box"])
7473
}
7574

76-
// CachedConcreteArrayTransformer should preserve elements
77-
@Test func splitPreservesParts() async throws {
75+
@Test func `split preserves part information`() async throws {
7876
let model = Sphere(diameter: 10)
7977
.adding {
8078
Box(5)

Tests/Tests/CircularOverhang.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Testing
22
@testable import Cadova
33

44
struct CircularOverhangTests {
5-
@Test func styles() async throws {
5+
@Test func `circular overhang methods produce correct geometry`() async throws {
66
try await Circle(diameter: 10)
77
.overhangSafe()
88
.extruded(height: 1)

0 commit comments

Comments
 (0)