Skip to content

Commit

Permalink
Add damage event tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sp4ce-cowboy committed Mar 22, 2024
1 parent e1a811a commit 9623257
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
12 changes: 12 additions & 0 deletions TowerForge/TowerForge.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
9B8696552BAD759F0002377C /* Grid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8696542BAD759F0002377C /* Grid.swift */; };
BA443D3D2BAD9557009F0FFB /* RemoveSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA443D3C2BAD9557009F0FFB /* RemoveSystem.swift */; };
BA443D3F2BAD9774009F0FFB /* RemoveEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA443D3E2BAD9774009F0FFB /* RemoveEvent.swift */; };
BA443D422BAD9885009F0FFB /* DamageEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA443D412BAD9885009F0FFB /* DamageEventTests.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -166,6 +167,7 @@
9B8696542BAD759F0002377C /* Grid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Grid.swift; sourceTree = "<group>"; };
BA443D3C2BAD9557009F0FFB /* RemoveSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveSystem.swift; sourceTree = "<group>"; };
BA443D3E2BAD9774009F0FFB /* RemoveEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoveEvent.swift; sourceTree = "<group>"; };
BA443D412BAD9885009F0FFB /* DamageEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DamageEventTests.swift; sourceTree = "<group>"; };
BABB7C052BA9A41000D54DAE /* TowerForceTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TowerForceTestPlan.xctestplan; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -376,6 +378,7 @@
52DF5FC02BA32B2600135367 /* TowerForgeTests */ = {
isa = PBXGroup;
children = (
BA443D402BAD9872009F0FFB /* EventTests */,
52DF5FE22BA3386400135367 /* TFCoreTests */,
52DF5FC12BA32B2600135367 /* TowerForgeTests.swift */,
);
Expand Down Expand Up @@ -448,6 +451,14 @@
path = Components;
sourceTree = "<group>";
};
BA443D402BAD9872009F0FFB /* EventTests */ = {
isa = PBXGroup;
children = (
BA443D412BAD9885009F0FFB /* DamageEventTests.swift */,
);
path = EventTests;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -671,6 +682,7 @@
files = (
52DF5FC22BA32B2600135367 /* TowerForgeTests.swift in Sources */,
52DF5FE42BA3391200135367 /* TFTexturesTests.swift in Sources */,
BA443D422BAD9885009F0FFB /* DamageEventTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
31 changes: 31 additions & 0 deletions TowerForge/TowerForgeTests/EventTests/DamageEventTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Foundation
import XCTest
@testable import TowerForge

final class DamageEventTests: XCTestCase {

override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func test_initializeDamageEvent() {
let entityId = UUID()
let timestamp = 1.0
let damage = 10.0
let damageEvent = DamageEvent(on: entityId, at: timestamp, with: damage)

XCTAssertEqual(damageEvent.timestamp, timestamp,
"DamageEvent must have the same timestamp as originally specified")

XCTAssertEqual(damageEvent.damage, damage,
"DamageEvent must have the same damage as originally specified")

XCTAssertEqual(damageEvent.entityId, entityId,
"DamageEvent must have the same entityId as originally specified")
}

}

0 comments on commit 9623257

Please sign in to comment.