mirror of
https://github.com/asticode/go-astikit.git
synced 2025-12-24 11:50:53 +08:00
Added bool
This commit is contained in:
8
bool.go
Normal file
8
bool.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package astikit
|
||||
|
||||
func BoolToUInt32(b bool) uint32 {
|
||||
if b {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
12
bool_test.go
Normal file
12
bool_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user