Skip to content

Commit

Permalink
Merge pull request #7 from fireblade-engine/fix-tests
Browse files Browse the repository at this point in the history
Fix nil image in tests
  • Loading branch information
ctreffs authored Apr 21, 2023
2 parents 53fda4b + f1d728d commit 3d46e60
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
}
},
{
"package": "SnapshotTesting",
"package": "swift-snapshot-testing",
"repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state": {
"branch": null,
"revision": "114882386a815f4a2e6d8f2f7ee4857acd372438",
"version": "1.7.2"
"revision": "cef5b3f6f11781dd4591bdd1dd0a3d22bd609334",
"version": "1.11.0"
}
},
{
"package": "SwiftGraph",
"repositoryURL": "https://github.com/davecom/SwiftGraph.git",
"state": {
"branch": null,
"revision": "3e9ed26e380b40fcadf80ef5d588829ced251673",
"version": "3.0.0"
"revision": "76b5180a5cc32eda7f5236a756f4c1e0936311c6",
"version": "3.1.0"
}
}
]
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Fireblade Graph

[![Build Status](https://travis-ci.com/fireblade-engine/graph.svg?branch=master)](https://travis-ci.com/fireblade-engine/graph)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
[![swift version](https://img.shields.io/badge/swift-5.2-brightgreen.svg)](#)
[![platforms](https://img.shields.io/badge/platforms-%20macOS%20|%20iOS%20|%20tvOS%20|%20watchOS%20|%20linux%20-brightgreen.svg)](#)

This is a **lightweight**, **fast** and **easy to use** [directed acyclic graph (DAG)](https://en.wikipedia.org/wiki/Directed_acyclic_graph) implementation in Swift.
It is developed and maintained as part of the [Fireblade Game Engine](https://github.com/fireblade-engine) project.
Expand Down Expand Up @@ -96,13 +93,13 @@ rootNode.update()

## 🏷️ Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](tags).
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the tags on this repository.

## ✍️ Authors

* [Christian Treffs](https://github.com/ctreffs)

See also the list of [contributors](graphs/contributors) who participated in this project.
See also the list of contributors who participated in this project.

## 🔏 License

Expand Down
14 changes: 8 additions & 6 deletions Tests/FirebladeGraphTests/TraversalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
// Created by Christian Treffs on 22.08.19.
//

import class XCTest.XCTestCase
import func XCTest.XCTAssertEqual
import XCTest
import FirebladeGraph
import struct Foundation.UUID
import SnapshotTesting
Expand All @@ -16,7 +15,7 @@ import SnapshotTesting
final class TraversalTests: XCTestCase {
typealias StringNode = Node<String>

func testDescendLinearGraph() {
func testDescendLinearGraph() throws {
let a = StringNode("a")
let b = StringNode("b")
let c = StringNode("c")
Expand Down Expand Up @@ -47,12 +46,14 @@ final class TraversalTests: XCTestCase {
let expected = [a, b, c, d, e, f, g, h, i, j].map { $0.content }
XCTAssertEqual(result, expected)

let image = try XCTUnwrap(a.renderGraphAsImage())

#if !os(Linux)
assertSnapshot(matching: a.renderGraphAsImage()!, as: .image)
assertSnapshot(matching: image, as: .image)
#endif
}

func testDescendSpreadingGraph() {
func testDescendSpreadingGraph() throws {
let a = Node<Int>(0)
let b = Node<Int>(1)
let c = Node<Int>(2)
Expand Down Expand Up @@ -85,8 +86,9 @@ final class TraversalTests: XCTestCase {
let expected = [a, b, c, e, f, g, d, h, i, j].map { $0.content }
XCTAssertEqual(result, expected)

let image = try XCTUnwrap(a.renderGraphAsImage())
#if !os(Linux)
assertSnapshot(matching: a.renderGraphAsImage()!, as: .image)
assertSnapshot(matching: image, as: .image)
#endif
}

Expand Down

0 comments on commit 3d46e60

Please sign in to comment.