Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for unit testing -- UNMERGED #32

Merged
merged 10 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: validate

on: [push, workflow_dispatch]

# TODO: add linting
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: CarbonSmasher/packtest_runner@9d13d673bf9d3f2fad2b833d036e5e12ff65e056
with:
packs: 'datapacks/omega-flowey'
Empty file added .gitmodules
Empty file.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ Back in early 2016 I released `Omega Flowey in Minecraft`.
- [original thread](https://www.reddit.com/r/Undertale/comments/4a9jht/spoilers_omega_flowey_boss_fight_in_minecraft/)

Since then I've gained a lot of skills both in Minecraft map development and in programming generally. This repo will store any and everything relating to development of a remaster of the original map for modern Minecraft version(s) with better gameplay, performance, and visuals.

## Contributing

### Setup

1. Configure git to automatically update submodules with `git pull`s by defaulting the `submodule.recurse` flag to `true`:

```bash
git config --global submodule.recurse true
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# b: int
# outputs:
# out: the higher value between `a` and `b` (Math.max(a, b))
execute store result score @s math.0 run data get storage utils:math.max a
execute store result score @s math.1 run data get storage utils:math.max b
execute store result storage utils:math.max out int 1 run scoreboard players get @s math.0
execute if score @s math.0 < @s math.1 store result storage utils:math.max out int 1 run scoreboard players get @s math.1
execute store result score #utils:math.max math.0 run data get storage utils:math.max a
execute store result score #utils:math.max math.1 run data get storage utils:math.max b
execute store result storage utils:math.max out int 1 run scoreboard players get #utils:math.max math.0
execute if score #utils:math.max math.0 < #utils:math.max math.1 store result storage utils:math.max out int 1 run scoreboard players get #utils:math.max math.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# b: int
# outputs:
# out: the lower value between `a` and `b` (Math.min(a, b))
execute store result score @s math.0 run data get storage utils:math.min a
execute store result score @s math.1 run data get storage utils:math.min b
execute store result storage utils:math.min out int 1 run scoreboard players get @s math.0
execute if score @s math.0 > @s math.1 store result storage utils:math.min out int 1 run scoreboard players get @s math.1
execute store result score #utils:math.min math.0 run data get storage utils:math.min a
execute store result score #utils:math.min math.1 run data get storage utils:math.min b
execute store result storage utils:math.min out int 1 run scoreboard players get #utils:math.min math.0
execute if score #utils:math.min math.0 > #utils:math.min math.1 store result storage utils:math.min out int 1 run scoreboard players get #utils:math.min math.1
27 changes: 27 additions & 0 deletions datapacks/omega-flowey/data/utils/tests/math/max.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# @batch utils:math

# setup
data remove storage utils:math.max a
data remove storage utils:math.max b
data remove storage utils:math.max out
scoreboard players reset *
function omega-flowey:setup

# cases
data merge storage utils:math.max { a: 10, b: 10 }
function utils:math/max
execute store result score #utils:math.max math.0 run data get storage utils:math.max out

assert score #utils:math.max math.0 matches 10

data merge storage utils:math.max { a: 0, b: 1 }
function utils:math/max
execute store result score #utils:math.max math.0 run data get storage utils:math.max out

assert score #utils:math.max math.0 matches 1

data merge storage utils:math.max { a: 2, b: 1 }
function utils:math/max
execute store result score #utils:math.max math.0 run data get storage utils:math.max out

assert score #utils:math.max math.0 matches 2
27 changes: 27 additions & 0 deletions datapacks/omega-flowey/data/utils/tests/math/min.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# @batch utils:math

# setup
data remove storage utils:math.min a
data remove storage utils:math.min b
data remove storage utils:math.min out
scoreboard players reset *
function omega-flowey:setup

# cases
data merge storage utils:math.min { a: 10, b: 10 }
function utils:math/min
execute store result score #utils:math.min math.0 run data get storage utils:math.min out

assert score #utils:math.min math.0 matches 10

data merge storage utils:math.min { a: 0, b: 1 }
function utils:math/min
execute store result score #utils:math.min math.0 run data get storage utils:math.min out

assert score #utils:math.min math.0 matches 0

data merge storage utils:math.min { a: 2, b: 1 }
function utils:math/min
execute store result score #utils:math.min math.0 run data get storage utils:math.min out

assert score #utils:math.min math.0 matches 1
7 changes: 7 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ what is the primary purpose of this PR?

---

## Test plan
<!--
does this PR include any unit tests for its new code?
if yes, briefly describe them.
if no, explain why.
-->

## Reproducing in-game
<!--
how to view the thing you added in-game (Minecraft), if applicable.
Expand Down
Binary file modified world.zip
Binary file not shown.