Files
tactical-shooter/addons/vest/test/mixins/expect-mixin.gd
T
shawn b0c83af092 Fresh start: replace with naxIO/netfox-cs-sample foundation
Complete replacement of the tactical-shooter project with the
netfox-cs-sample (MIT) — a CS 1.6 inspired multiplayer FPS built
with Godot 4 and netfox.

## What's new
- Full CS-style gameplay: teams (T/CT), rounds, economy, buy menu
- 6 weapons: Knife, Glock, USP, AK-47, M4A1, AWP
- Bomb plant/defuse with 2 bombsites
- Flashbang & smoke grenades
- Proper netfox rollback netcode at 64 tick
- Network popup UI for host/join
- HUD, crosshair, round timer, scoreboard
- All netfox singletons registered as autoloads (works in exported builds)

## Architecture
- Listen-server (host from client, no dedicated server binary)
- Multiplayer-fps game lives at examples/multiplayer-fps/
- Netfox addons registered as autoloads for exported build compat
- Godot 4.7 with Forward+ renderer

## Removed
- Old headless-server architecture (client_main, server_main, player.gd, etc.)
- Custom netfox bootstrap with ENet fallback
- Old ChaffGames FPS template (2,420 lines, 844 KB)
- SimulationServer GDExtension stub
- Godot-jolt physics (netfox sample uses default Godot physics)
- Duplicate weapon_data.gd, anti_cheat.gd, round_manager.gd, etc.
- Server browser API Python venv (87 MB)
- test_range map and modular assets

## Preserved
- Git history
- Server config at config/default_server_config.cfg
- Windows export preset
- Build directory (gitignored)

Co-authored-by: naxIO <naxIO@users.noreply.github.com>
2026-07-02 20:55:20 -04:00

125 lines
4.2 KiB
GDScript

extends VestTestMixin
## Mixin for asserting test requirement
##
## @tutorial(Assertions): https://foxssake.github.io/vest/latest/user-guide/assertions/
## Expect a [param condition] to be true.
func expect(condition: bool, p_message: String = "") -> void:
if condition:
ok()
else:
fail(p_message)
## Expect a [param condition] to be false.
func expect_not(condition: bool, p_message: String = "") -> void:
if not condition:
ok()
else:
fail(p_message)
## Expect two values to be equal.
## [br][br]
## If [param actual] has an [code]equals()[/code] method, it will be used.
func expect_equal(actual: Variant, expected: Variant, p_message: String = "Actual value differs from expected!") -> void:
if Vest.__.Matchers.is_equal(actual, expected):
ok()
else:
fail(p_message, { "expect": expected, "got": actual })
## Expect two values not to be equal.
## [br][br]
## If [param actual] has an [code]equals()[/code] method, it will be used.
func expect_not_equal(actual: Variant, expected: Variant, p_message: String = "Actual value equals expected!") -> void:
if Vest.__.Matchers.is_equal(actual, expected):
fail(p_message, { "expect": expected, "got": actual })
else:
ok()
## Expect a [param condition] to be true.
## [br][br]
## Synonim of [method expect], aimed at better readability for asserting bools.
func expect_true(condition: bool, p_message: String = "") -> void:
expect(condition, p_message)
## Expect a [param condition] to be false.
## [br][br]
## Synonim of [method expect_not], aimed at better readability for asserting
## bools.
func expect_false(condition: bool, p_message: String = "") -> void:
expect_not(condition, p_message)
## Expect an [param object] to be empty.
## [br][br]
## If it's a custom type implementing [code]is_empty()[/code], that method will
## be used.
func expect_empty(object: Variant, p_message: String = "Object was not empty!") -> void:
match Vest.__.Matchers.is_empty(object):
true:
ok()
false:
fail(p_message)
ERR_METHOD_NOT_FOUND:
fail("Object has no is_empty() method!", { "object": object })
ERR_CANT_RESOLVE:
fail("Unknown object, can't be checked for emptiness!", { "object": object })
## Expect an [param object] to not be empty.
## [br][br]
## If it's a custom type implementing [code]is_empty()[/code], that method will
## be used.
func expect_not_empty(object: Variant, p_message: String = "Object was empty!") -> void:
match Vest.__.Matchers.is_empty(object):
true:
fail(p_message)
false:
ok()
ERR_METHOD_NOT_FOUND:
fail("Object has no is_empty() method!", { "object": object })
ERR_CANT_RESOLVE:
fail("Unknown object, can't be checked for emptiness!", { "object": object })
## Expect an [param object] to contain [param item].
## [br][br]
## If it's a custom type implementing [code]has()[/code], that method will be
## used.
func expect_contains(object: Variant, item: Variant, p_message: String = "Item is missing from collection!") -> void:
match Vest.__.Matchers.contains(object, item):
true:
ok()
false:
fail(p_message, { "got": object, "missing": item })
ERR_METHOD_NOT_FOUND:
fail("Object has no has() method!", { "object": object })
ERR_CANT_RESOLVE:
fail("Unknown object, can't be checked if it contains item!", { "object": object })
## Expect an [param object] to not contain [param item].
## [br][br]
## If it's a custom type implementing [code]has()[/code], that method will be
## used.
func expect_does_not_contain(object: Variant, item: Variant, p_message: String = "Item is in collection!") -> void:
match Vest.__.Matchers.contains(object, item):
true:
fail(p_message, { "got": object, "excess": item })
false:
ok()
ERR_METHOD_NOT_FOUND:
fail("Object has no has() method!", { "object": object })
ERR_CANT_RESOLVE:
fail("Unknown object, can't be checked if it contains item!", { "object": object })
## Expect a [param value] to be null.
func expect_null(value: Variant, p_message: String = "Item is not null!") -> void:
if value == null:
ok()
else:
fail(p_message, { "got": value })
## Expect a [param value] to not be null.
func expect_not_null(value: Variant, p_message: String = "Item is null!") -> void:
if value != null:
ok()
else:
fail(p_message)