Added bool

This commit is contained in:
Quentin Renard
2022-09-29 15:49:19 +02:00
parent d8204b0bf1
commit ad09659d94
2 changed files with 20 additions and 0 deletions

8
bool.go Normal file
View File

@@ -0,0 +1,8 @@
package astikit
func BoolToUInt32(b bool) uint32 {
if b {
return 1
}
return 0
}

12
bool_test.go Normal file
View File

@@ -0,0 +1,12 @@
package astikit
import "testing"
func TestBoolToUInt32(t *testing.T) {
if e, g := uint32(0), BoolToUInt32(false); e != g {
t.Errorf("expected %d, got %d", e, g)
}
if e, g := uint32(1), BoolToUInt32(true); e != g {
t.Errorf("expected %d, got %d", e, g)
}
}