Project ready for testing

This commit is contained in:
Christian Treffs 2017-10-21 23:54:43 +02:00
parent 22d65c9a6f
commit 5371107f4f
7 changed files with 39 additions and 65 deletions

View File

@ -1,22 +0,0 @@
//
// Utils.swift
// FirebladeECS
//
// Created by Christian Treffs on 09.10.17.
//
#if os(macOS) || os(iOS) || os(tvOS)
import CoreFoundation
#endif
#if os(macOS) || os(iOS) || os(tvOS)
func retainCount<T: AnyObject>(_ ref: T?) -> Int {
let retainCount: CFIndex = CFGetRetainCount(ref)
return retainCount
}
#else
func retainCount<T: AnyObject>(_ ref: T?) -> Int { return -1 }
#endif

View File

@ -33,5 +33,8 @@ class Velocity: Component {
}
class Party: Component {
var partying: Bool
init(partying: Bool) {
self.partying = partying
}
}

View File

@ -0,0 +1,33 @@
//
// ComponentTests.swift
// FirebladeECSTests
//
// Created by Christian Treffs on 21.10.17.
//
import XCTest
@testable import FirebladeECS
class ComponentTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testComponentIdentifier() {
let p1 = Position(x: 1, y: 2)
XCTAssert(p1.identifier == Position.identifier)
let v1 = Velocity(a: 3.14)
XCTAssert(v1.identifier == Velocity.identifier)
XCTAssert(v1.identifier != p1.identifier)
XCTAssert(Velocity.identifier != Position.identifier)
}
}

View File

@ -1,16 +0,0 @@
//
// EntityComponentTests.swift
// FirebladeECS
//
// Created by Christian Treffs on 13.10.17.
//
import XCTest
/*@testable */import FirebladeECS
class EntityComponentTests: XCTestCase {
func testComponentAccess() {
}
}

View File

@ -37,10 +37,12 @@ class NexusTests: XCTestCase {
XCTAssert(nexus.count == 0)
let e0 = nexus.create()
XCTAssert(e0.identifier.index == 0)
XCTAssert(nexus.isValid(entity: e0))
XCTAssert(nexus.count == 1)
let e1 = nexus.create(entity: "Named e1")
XCTAssert(e1.identifier.index == 1)
XCTAssert(nexus.isValid(entity: e1))
XCTAssert(nexus.count == 2)

View File

@ -1,13 +0,0 @@
//
// PerformanceTests.swift
// FirebladeECS
//
// Created by Christian Treffs on 09.10.17.
//
import XCTest
@testable import FirebladeECS
class PerformanceTests: XCTestCase {
}

View File

@ -1,13 +0,0 @@
//
// SystemTests.swift
// FirebladeECS
//
// Created by Christian Treffs on 11.10.17.
//
import XCTest
import FirebladeECS
class SystemTests: XCTestCase {
}