This commit is contained in:
Christian Treffs 2020-08-05 09:49:07 +02:00
parent 040d1197b0
commit 66eac2898d
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
18 changed files with 30 additions and 54 deletions

View File

@ -5,7 +5,7 @@
// Created by Christian Treffs on 20.08.19.
//
public protocol NexusEventDelegate: class {
public protocol NexusEventDelegate: AnyObject {
func nexusEvent(_ event: NexusEvent)
func nexusNonFatalError(_ message: String)
}

View File

@ -8,11 +8,9 @@
import FirebladeECS
class EmptyComponent: Component {
}
class Name: Component {
var name: String
init(name: String) {
self.name = name
@ -20,7 +18,6 @@ class Name: Component {
}
class Position: Component {
var x: Int
var y: Int
init(x: Int, y: Int) {
@ -30,7 +27,6 @@ class Position: Component {
}
class Velocity: Component {
var a: Float
init(a: Float) {
self.a = a
@ -38,7 +34,6 @@ class Velocity: Component {
}
class Party: Component {
var partying: Bool
init(partying: Bool) {
self.partying = partying
@ -46,7 +41,6 @@ class Party: Component {
}
class Color: Component {
var r: UInt8 = 0
var g: UInt8 = 0
var b: UInt8 = 0

View File

@ -9,7 +9,6 @@ import FirebladeECS
import XCTest
class ComponentIdentifierTests: XCTestCase {
/// release: 0.034 sec
/// debug: 0.456 sec
func testMeasureStaticComponentIdentifier() {

View File

@ -9,7 +9,6 @@ import FirebladeECS
import XCTest
class HashingPerformanceTests: XCTestCase {
/// release: 0.726 sec
/// debug: 3.179 sec
func testMeasureCombineHash() {
@ -97,5 +96,4 @@ class HashingPerformanceTests: XCTestCase {
}
#endif
}
}

View File

@ -90,5 +90,4 @@ final class TypeIdentifierPerformanceTests: XCTestCase {
}
}
}
}

View File

@ -60,7 +60,7 @@ extension TypedFamilyPerformanceTests {
}
public func __allTests() -> [XCTestCaseEntry] {
return [
[
testCase(ComponentIdentifierTests.__allTests__ComponentIdentifierTests),
testCase(HashingPerformanceTests.__allTests__HashingPerformanceTests),
testCase(TypeIdentifierPerformanceTests.__allTests__TypeIdentifierPerformanceTests),

View File

@ -8,7 +8,6 @@
import FirebladeECS
class EmptyComponent: Component {
}
class Name: Component {
@ -136,7 +135,7 @@ class PositionSystem {
}
func randNorm() -> Double {
return 4.0
4.0
}
func update() {

View File

@ -7,7 +7,6 @@
import XCTest
final class ComponentIdentifierTests: XCTestCase {
func testMirrorAsStableIdentifier() {
let m = String(reflecting: Position.self)
let identifier: String = m

View File

@ -9,7 +9,6 @@ import FirebladeECS
import XCTest
final class EntityCreationTests: XCTestCase {
func testCreateEntityOneComponent() throws {
let nexus = Nexus()
let entity = nexus.createEntity {
@ -76,5 +75,4 @@ final class EntityCreationTests: XCTestCase {
XCTAssertEqual(nexus.numComponents, 200)
XCTAssertEqual(nexus.numFamilies, 0)
}
}

View File

@ -107,7 +107,6 @@ class EntityTests: XCTestCase {
XCTAssertEqual(entity[Position.self]?.x, 1234)
XCTAssertNil(entity[Velocity.self]?.a)
}
}
extension Sequence {

View File

@ -9,7 +9,6 @@ import FirebladeECS
import XCTest
final class FamilyCodingTests: XCTestCase {
func testEncodingFamily1() throws {
let nexus = Nexus()
@ -49,7 +48,6 @@ final class FamilyCodingTests: XCTestCase {
let newEntities = try family.decodeMembers(from: jsonData, using: &jsonDecoder)
XCTAssertEqual(newEntities.count, 2)
XCTAssertEqual(family.count, 2)
}
func testEncodeFamily2() throws {
@ -301,7 +299,6 @@ final class FamilyCodingTests: XCTestCase {
}
func testFailDecodingFamily() {
let jsonString = """
[
{

View File

@ -54,13 +54,12 @@ class HashingTests: XCTestCase {
func testStringHashes() throws {
let string = "EiMersaufEn1"
XCTAssertEqual(StringHashing.bernstein_djb2(string), 13447802024599246090)
XCTAssertEqual(StringHashing.singer_djb2(string), 5428736256651916664)
XCTAssertEqual(StringHashing.sdbm(string), 15559770072020577201)
XCTAssertEqual(StringHashing.bernstein_djb2("gamedev"), 229466792000542)
XCTAssertEqual(StringHashing.singer_djb2("gamedev"), 2867840411746895486)
XCTAssertEqual(StringHashing.sdbm("gamedev"), 2761443862055442870)
XCTAssertEqual(StringHashing.bernstein_djb2(string), 13_447_802_024_599_246_090)
XCTAssertEqual(StringHashing.singer_djb2(string), 5_428_736_256_651_916_664)
XCTAssertEqual(StringHashing.sdbm(string), 15_559_770_072_020_577_201)
XCTAssertEqual(StringHashing.bernstein_djb2("gamedev"), 229_466_792_000_542)
XCTAssertEqual(StringHashing.singer_djb2("gamedev"), 2_867_840_411_746_895_486)
XCTAssertEqual(StringHashing.sdbm("gamedev"), 2_761_443_862_055_442_870)
}
}

View File

@ -5,12 +5,11 @@
// Created by Christian Treffs on 30.09.19.
//
import XCTest
import FirebladeECS
import XCTest
@available(*, deprecated, message: "This will be removed in the next minor update.")
class SceneGraphTests: XCTestCase {
var nexus: Nexus!
override func setUp() {
@ -130,5 +129,4 @@ class SceneGraphTests: XCTestCase {
XCTAssertEqual(parentSum, 36)
XCTAssertEqual(childSum, 45)
}
}

View File

@ -540,7 +540,6 @@ class SparseSetTests: XCTestCase {
}
func testAlternativeKey() {
let set = UnorderedSparseSet<Character, String>()
set.insert("A", at: "a")
@ -554,11 +553,9 @@ class SparseSetTests: XCTestCase {
XCTAssertEqual(a.0, b.0)
XCTAssertEqual(a.1, b.1)
}
}
func testEquality() {
let setA = UnorderedSparseSet<Int, String>()
let setB = UnorderedSparseSet<Int, String>()

View File

@ -172,7 +172,7 @@ extension SystemsTests {
}
public func __allTests() -> [XCTestCaseEntry] {
return [
[
testCase(ComponentIdentifierTests.__allTests__ComponentIdentifierTests),
testCase(ComponentTests.__allTests__ComponentTests),
testCase(EntityCreationTests.__allTests__EntityCreationTests),