forked from yvasiyarov/php_session_decoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon_helper_test.go
73 lines (65 loc) · 1.56 KB
/
common_helper_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package php_serialize
import "testing"
func TestPhpValueString(t *testing.T) {
var (
val PhpValue = "string"
expected string = "string"
)
if newVal := PhpValueString(val); newVal != expected {
t.Errorf("Expected %q but got %q", expected, newVal)
}
}
func TestPhpValueBool(t *testing.T) {
var (
val PhpValue = true
expected bool = true
)
if newVal := PhpValueBool(val); newVal != expected {
t.Errorf("Expected %t but got %t", expected, newVal)
}
}
func TestPhpValueInt(t *testing.T) {
var (
val PhpValue = 10
expected int = 10
)
if newVal := PhpValueInt(val); newVal != expected {
t.Errorf("Expected %d but got %d", expected, newVal)
}
}
func TestPhpValueInt64(t *testing.T) {
var (
val PhpValue = int64(10)
expected int64 = 10
)
if newVal := PhpValueInt64(val); newVal != expected {
t.Errorf("Expected %d but got %d", expected, newVal)
}
}
func TestPhpValueUInt(t *testing.T) {
var (
val PhpValue = uint(10)
expected uint = 10
)
if newVal := PhpValueUInt(val); newVal != expected {
t.Errorf("Expected %d but got %d", expected, newVal)
}
}
func TestPhpValueUInt64(t *testing.T) {
var (
val PhpValue = uint64(10)
expected uint64 = 10
)
if newVal := PhpValueUInt64(val); newVal != expected {
t.Errorf("Expected %d but got %d", expected, newVal)
}
}
func TestPhpValueFloat64(t *testing.T) {
var (
val PhpValue = float64(10.0)
expected float64 = 10.0
)
if newVal := PhpValueFloat64(val); newVal != expected {
t.Errorf("Expected %v but got %v", expected, newVal)
}
}