github.com/enbility/spine-go@v0.7.0/spine/operations_test.go (about) 1 package spine 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestOperations(t *testing.T) { 10 operations := NewOperations(true, true, false, false) 11 assert.NotNil(t, operations) 12 13 text := operations.String() 14 assert.NotEqual(t, 0, len(text)) 15 16 data := operations.Information() 17 assert.NotNil(t, data) 18 19 result := operations.Read() 20 assert.True(t, result) 21 result = operations.ReadPartial() 22 assert.True(t, result) 23 result = operations.Write() 24 assert.False(t, result) 25 result = operations.WritePartial() 26 assert.False(t, result) 27 28 operations2 := NewOperations(true, false, true, true) 29 assert.NotNil(t, operations2) 30 31 text = operations2.String() 32 assert.NotEqual(t, 0, len(text)) 33 34 data = operations2.Information() 35 assert.NotNil(t, data) 36 37 result = operations2.Read() 38 assert.True(t, result) 39 result = operations2.ReadPartial() 40 assert.False(t, result) 41 result = operations2.Write() 42 assert.True(t, result) 43 result = operations2.WritePartial() 44 assert.True(t, result) 45 46 operations3 := NewOperations(false, false, false, false) 47 assert.NotNil(t, operations3) 48 49 text = operations3.String() 50 assert.NotEqual(t, 0, len(text)) 51 52 data = operations3.Information() 53 assert.NotNil(t, data) 54 55 result = operations3.Read() 56 assert.False(t, result) 57 result = operations3.ReadPartial() 58 assert.False(t, result) 59 result = operations3.Write() 60 assert.False(t, result) 61 result = operations3.WritePartial() 62 assert.False(t, result) 63 }