-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from aksiome/color-tests
✅ Color module tests
- Loading branch information
Showing
7 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
datapacks/Bookshelf/data/bs.color/tests/hex_to_int.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Color is converted the right way | ||
# @batch bs.color | ||
|
||
execute store result score #result bs.data run function #bs.color:hex_to_int {color:"#F26A3B"} | ||
assert data storage bs:out color{hex_to_int:15886907} | ||
assert score $color.hex_to_int bs.out matches 15886907 | ||
assert score #result bs.data matches 15886907 | ||
|
||
execute store result score #result bs.data run function #bs.color:hex_to_int {color:"#2AC855"} | ||
assert score #result bs.data matches 2803797 | ||
|
||
execute store result score #result bs.data run function #bs.color:hex_to_int {color:"#5919C0"} | ||
assert score #result bs.data matches 5839296 |
14 changes: 14 additions & 0 deletions
14
datapacks/Bookshelf/data/bs.color/tests/hex_to_rgb.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Color is converted the right way | ||
# @batch bs.color | ||
|
||
function #bs.color:hex_to_rgb {color:"#F26A3B"} | ||
assert score $color.hex_to_rgb.r bs.out matches 242 | ||
assert score $color.hex_to_rgb.g bs.out matches 106 | ||
assert score $color.hex_to_rgb.b bs.out matches 59 | ||
assert data storage bs:out color{hex_to_rgb:[242,106,59]} | ||
|
||
function #bs.color:hex_to_rgb {color:"#2AC855"} | ||
assert data storage bs:out color{hex_to_rgb:[42,200,85]} | ||
|
||
function #bs.color:hex_to_rgb {color:"#5919C0"} | ||
assert data storage bs:out color{hex_to_rgb:[89,25,192]} |
11 changes: 11 additions & 0 deletions
11
datapacks/Bookshelf/data/bs.color/tests/int_to_hex.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Color is converted the right way | ||
# @batch bs.color | ||
|
||
function #bs.color:int_to_hex {color:15886907} | ||
assert data storage bs:out color{int_to_hex:"#f26a3b"} | ||
|
||
function #bs.color:int_to_hex {color:2803797} | ||
assert data storage bs:out color{int_to_hex:"#2ac855"} | ||
|
||
function #bs.color:int_to_hex {color:5839296} | ||
assert data storage bs:out color{int_to_hex:"#5919c0"} |
14 changes: 14 additions & 0 deletions
14
datapacks/Bookshelf/data/bs.color/tests/int_to_rgb.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Color is converted the right way | ||
# @batch bs.color | ||
|
||
function #bs.color:int_to_rgb {color:15886907} | ||
assert score $color.int_to_rgb.r bs.out matches 242 | ||
assert score $color.int_to_rgb.g bs.out matches 106 | ||
assert score $color.int_to_rgb.b bs.out matches 59 | ||
assert data storage bs:out color{int_to_rgb:[242,106,59]} | ||
|
||
function #bs.color:int_to_rgb {color:2803797} | ||
assert data storage bs:out color{int_to_rgb:[42,200,85]} | ||
|
||
function #bs.color:int_to_rgb {color:5839296} | ||
assert data storage bs:out color{int_to_rgb:[89,25,192]} |
11 changes: 11 additions & 0 deletions
11
datapacks/Bookshelf/data/bs.color/tests/rgb_to_hex.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Color is converted the right way | ||
# @batch bs.color | ||
|
||
function #bs.color:rgb_to_hex {color:[242,106,59]} | ||
assert data storage bs:out color{rgb_to_hex:"#f26a3b"} | ||
|
||
function #bs.color:rgb_to_hex {color:[42,200,85]} | ||
assert data storage bs:out color{rgb_to_hex:"#2ac855"} | ||
|
||
function #bs.color:rgb_to_hex {color:[89,25,192]} | ||
assert data storage bs:out color{rgb_to_hex:"#5919c0"} |
13 changes: 13 additions & 0 deletions
13
datapacks/Bookshelf/data/bs.color/tests/rgb_to_int.mcfunction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Color is converted the right way | ||
# @batch bs.color | ||
|
||
execute store result score #result bs.data run function #bs.color:rgb_to_int {color:[242,106,59]} | ||
assert data storage bs:out color{rgb_to_int:15886907} | ||
assert score $color.rgb_to_int bs.out matches 15886907 | ||
assert score #result bs.data matches 15886907 | ||
|
||
execute store result score #result bs.data run function #bs.color:rgb_to_int {color:[42,200,85]} | ||
assert score #result bs.data matches 2803797 | ||
|
||
execute store result score #result bs.data run function #bs.color:rgb_to_int {color:[89,25,192]} | ||
assert score #result bs.data matches 5839296 |