The previous tests never compiled: they used GUT's assert functions, Godot 3 APIs and reassigned autoload functions, so no test ran. - 90 tests: unit tests for the playlist, songs, player scoring, time formatting, search and the server client, plus integration tests that run MainWindow and SyncWindow against a fake server - Keybind tests check that Alt+<number> and Ctrl+Alt+<number> keep following the player rows while players are added and removed - run_tests.sh finds Godot and runs the suite headless (~10 seconds) - CI runs the tests before the build job in gitea-build.yaml; the separate test.yml used a GitHub action that does not exist - GdUnit4 is committed instead of ignored, since the project enables it, and .gitea/ is no longer ignored - Exported builds leave out tests/ and addons/gdUnit4/
81 lines
3.3 KiB
GDScript
81 lines
3.3 KiB
GDScript
## Factory class providing convenient static methods to create various fuzzer instances.[br]
|
|
##
|
|
## Fuzzers is a utility class that simplifies the creation of different fuzzer types
|
|
## for testing purposes. It provides static factory methods that create pre-configured
|
|
## fuzzers with sensible defaults, making it easier to set up fuzz testing in your
|
|
## test suites without manually instantiating each fuzzer type.[br]
|
|
##
|
|
## This class acts as a central access point for all fuzzer types, improving code
|
|
## readability and reducing boilerplate in test cases.[br]
|
|
##
|
|
## @tutorial(Fuzzing Testing): https://en.wikipedia.org/wiki/Fuzzing
|
|
class_name Fuzzers
|
|
extends Resource
|
|
|
|
|
|
## Generates random strings with length between [param min_length] and
|
|
## [param max_length] (inclusive), using characters from [param charset].
|
|
## See [StringFuzzer] for detailed documentation and examples.
|
|
static func rand_str(min_length: int, max_length: int, charset := StringFuzzer.DEFAULT_CHARSET) -> StringFuzzer:
|
|
return StringFuzzer.new(min_length, max_length, charset)
|
|
|
|
|
|
## Creates a [BoolFuzzer] for generating random boolean values.[br]
|
|
##
|
|
## See [BoolFuzzer] for detailed documentation and examples.
|
|
static func boolean() -> BoolFuzzer:
|
|
return BoolFuzzer.new()
|
|
|
|
|
|
## Creates an [IntFuzzer] for generating random integers within a range.[br]
|
|
##
|
|
## Generates random integers between [param from] and [param to] (inclusive)
|
|
## using [constant IntFuzzer.NORMAL] mode.
|
|
## See [IntFuzzer] for detailed documentation and examples.
|
|
static func rangei(from: int, to: int) -> IntFuzzer:
|
|
return IntFuzzer.new(from, to)
|
|
|
|
|
|
## Creates a [FloatFuzzer] for generating random floats within a range.[br]
|
|
##
|
|
## Generates random float values between [param from] and [param to] (inclusive).
|
|
## See [FloatFuzzer] for detailed documentation and examples.
|
|
static func rangef(from: float, to: float) -> FloatFuzzer:
|
|
return FloatFuzzer.new(from, to)
|
|
|
|
|
|
## Creates a [Vector2Fuzzer] for generating random 2D vectors within a range.[br]
|
|
##
|
|
## Generates random Vector2 values where each component is bounded by
|
|
## [param from] and [param to] (inclusive).
|
|
## See [Vector2Fuzzer] for detailed documentation and examples.
|
|
static func rangev2(from: Vector2, to: Vector2) -> Vector2Fuzzer:
|
|
return Vector2Fuzzer.new(from, to)
|
|
|
|
|
|
## Creates a [Vector3Fuzzer] for generating random 3D vectors within a range.[br]
|
|
##
|
|
## Generates random Vector3 values where each component is bounded by
|
|
## [param from] and [param to] (inclusive).
|
|
## See [Vector3Fuzzer] for detailed documentation and examples.
|
|
static func rangev3(from: Vector3, to: Vector3) -> Vector3Fuzzer:
|
|
return Vector3Fuzzer.new(from, to)
|
|
|
|
|
|
## Creates an [IntFuzzer] that generates only even integers.[br]
|
|
##
|
|
## Generates random even integers between [param from] and [param to] (inclusive)
|
|
## using [constant IntFuzzer.EVEN] mode.
|
|
## See [IntFuzzer] for detailed documentation about even number generation.
|
|
static func eveni(from: int, to: int) -> IntFuzzer:
|
|
return IntFuzzer.new(from, to, IntFuzzer.EVEN)
|
|
|
|
|
|
## Creates an [IntFuzzer] that generates only odd integers.[br]
|
|
##
|
|
## Generates random odd integers between [param from] and [param to] (inclusive)
|
|
## using [constant IntFuzzer.ODD] mode.
|
|
## See [IntFuzzer] for detailed documentation about odd number generation.
|
|
static func oddi(from: int, to: int) -> IntFuzzer:
|
|
return IntFuzzer.new(from, to, IntFuzzer.ODD)
|