parent
ab29ec20be
commit
5e7aee5e76
@ -0,0 +1,7 @@ |
||||
<component name="ProjectRunConfigurationManager"> |
||||
<configuration default="false" name="All Tests" type="CompoundRunConfigurationType"> |
||||
<toRun name="Client Tests" type="JavaScriptTestRunnerJest" /> |
||||
<toRun name="Server Tests" type="GoTestRunConfiguration" /> |
||||
<method v="2" /> |
||||
</configuration> |
||||
</component> |
@ -0,0 +1,11 @@ |
||||
<component name="ProjectRunConfigurationManager"> |
||||
<configuration default="false" name="Client Tests" type="JavaScriptTestRunnerJest"> |
||||
<node-interpreter value="project" /> |
||||
<node-options value="" /> |
||||
<jest-package value="$PROJECT_DIR$/client/node_modules/react-scripts" /> |
||||
<working-dir value="$PROJECT_DIR$/client" /> |
||||
<envs /> |
||||
<scope-kind value="ALL" /> |
||||
<method v="2" /> |
||||
</configuration> |
||||
</component> |
@ -0,0 +1,13 @@ |
||||
<component name="ProjectRunConfigurationManager"> |
||||
<configuration default="false" name="Server Tests" type="GoTestRunConfiguration" factoryName="Go Test"> |
||||
<module name="hexmap" /> |
||||
<working_directory value="$PROJECT_DIR$/server" /> |
||||
<go_parameters value="-i" /> |
||||
<kind value="DIRECTORY" /> |
||||
<package value="git.reya.zone/reya/hexmap" /> |
||||
<directory value="$PROJECT_DIR$/server" /> |
||||
<filePath value="$PROJECT_DIR$" /> |
||||
<framework value="gotest" /> |
||||
<method v="2" /> |
||||
</configuration> |
||||
</component> |
@ -0,0 +1,17 @@ |
||||
<component name="ProjectRunConfigurationManager"> |
||||
<configuration default="false" name="mage protobuf:build" type="ShConfigurationType"> |
||||
<option name="SCRIPT_TEXT" value="" /> |
||||
<option name="INDEPENDENT_SCRIPT_PATH" value="true" /> |
||||
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/mage.sh" /> |
||||
<option name="SCRIPT_OPTIONS" value="-v protobuf:build" /> |
||||
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" /> |
||||
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" /> |
||||
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" /> |
||||
<option name="INTERPRETER_PATH" value="/bin/bash" /> |
||||
<option name="INTERPRETER_OPTIONS" value="" /> |
||||
<option name="EXECUTE_IN_TERMINAL" value="false" /> |
||||
<option name="EXECUTE_SCRIPT_FILE" value="true" /> |
||||
<envs /> |
||||
<method v="2" /> |
||||
</configuration> |
||||
</component> |
@ -0,0 +1,14 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project version="4"> |
||||
<component name="WebResourcesPaths"> |
||||
<contentEntries> |
||||
<entry url="file://$PROJECT_DIR$"> |
||||
<entryData> |
||||
<resourceRoots> |
||||
<path value="file://$PROJECT_DIR$/client/public" /> |
||||
</resourceRoots> |
||||
</entryData> |
||||
</entry> |
||||
</contentEntries> |
||||
</component> |
||||
</project> |
@ -0,0 +1,240 @@ |
||||
package action |
||||
|
||||
import ( |
||||
"git.reya.zone/reya/hexmap/server/state" |
||||
"google.golang.org/protobuf/runtime/protoimpl" |
||||
"reflect" |
||||
"testing" |
||||
) |
||||
|
||||
func TestCellColor_ToClientPB(t *testing.T) { |
||||
type fields struct { |
||||
At state.StorageCoordinates |
||||
Color state.Color |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want *ClientActionPB |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := CellColor{ |
||||
At: tt.fields.At, |
||||
Color: tt.fields.Color, |
||||
} |
||||
if got := c.ToClientPB(); !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToClientPB() = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestCellColor_ToServerPB(t *testing.T) { |
||||
type fields struct { |
||||
At state.StorageCoordinates |
||||
Color state.Color |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want *ServerActionPB |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := CellColor{ |
||||
At: tt.fields.At, |
||||
Color: tt.fields.Color, |
||||
} |
||||
if got := c.ToServerPB(); !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToServerPB() = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestCellSetColorPB_ToGo(t *testing.T) { |
||||
type fields struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
Color uint32 |
||||
At *state.StorageCoordinatesPB |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want *CellColor |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
x := &CellSetColorPB{ |
||||
state: tt.fields.state, |
||||
sizeCache: tt.fields.sizeCache, |
||||
unknownFields: tt.fields.unknownFields, |
||||
Color: tt.fields.Color, |
||||
At: tt.fields.At, |
||||
} |
||||
got, err := x.ToGo() |
||||
if (err != nil) != tt.wantErr { |
||||
t.Errorf("ToGo() error = %v, wantErr %v", err, tt.wantErr) |
||||
return |
||||
} |
||||
if !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToGo() got = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestClientActionPB_ToGo(t *testing.T) { |
||||
type fields struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
Action isClientActionPB_Action |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want Client |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
x := &ClientActionPB{ |
||||
state: tt.fields.state, |
||||
sizeCache: tt.fields.sizeCache, |
||||
unknownFields: tt.fields.unknownFields, |
||||
Action: tt.fields.Action, |
||||
} |
||||
got, err := x.ToGo() |
||||
if (err != nil) != tt.wantErr { |
||||
t.Errorf("ToGo() error = %v, wantErr %v", err, tt.wantErr) |
||||
return |
||||
} |
||||
if !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToGo() got = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestServerActionPB_ToGo(t *testing.T) { |
||||
type fields struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
Action isServerActionPB_Action |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want Server |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
x := &ServerActionPB{ |
||||
state: tt.fields.state, |
||||
sizeCache: tt.fields.sizeCache, |
||||
unknownFields: tt.fields.unknownFields, |
||||
Action: tt.fields.Action, |
||||
} |
||||
got, err := x.ToGo() |
||||
if (err != nil) != tt.wantErr { |
||||
t.Errorf("ToGo() error = %v, wantErr %v", err, tt.wantErr) |
||||
return |
||||
} |
||||
if !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToGo() got = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestUserActiveColor_ToClientPB(t *testing.T) { |
||||
type fields struct { |
||||
Color state.Color |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want *ClientActionPB |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := UserActiveColor{ |
||||
Color: tt.fields.Color, |
||||
} |
||||
if got := c.ToClientPB(); !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToClientPB() = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestUserActiveColor_ToServerPB(t *testing.T) { |
||||
type fields struct { |
||||
Color state.Color |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want *ServerActionPB |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := UserActiveColor{ |
||||
Color: tt.fields.Color, |
||||
} |
||||
if got := c.ToServerPB(); !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToServerPB() = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestUserSetActiveColorPB_ToGo(t *testing.T) { |
||||
type fields struct { |
||||
state protoimpl.MessageState |
||||
sizeCache protoimpl.SizeCache |
||||
unknownFields protoimpl.UnknownFields |
||||
Color uint32 |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
want *UserActiveColor |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
x := &UserSetActiveColorPB{ |
||||
state: tt.fields.state, |
||||
sizeCache: tt.fields.sizeCache, |
||||
unknownFields: tt.fields.unknownFields, |
||||
Color: tt.fields.Color, |
||||
} |
||||
if got := x.ToGo(); !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("ToGo() = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
@ -0,0 +1,190 @@ |
||||
package action |
||||
|
||||
import ( |
||||
"git.reya.zone/reya/hexmap/server/state" |
||||
"go.uber.org/zap/zapcore" |
||||
"reflect" |
||||
"testing" |
||||
) |
||||
|
||||
func TestCellColor_Apply(t *testing.T) { |
||||
type fields struct { |
||||
At state.StorageCoordinates |
||||
Color state.Color |
||||
} |
||||
type args struct { |
||||
s *state.Synced |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
args args |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := CellColor{ |
||||
At: tt.fields.At, |
||||
Color: tt.fields.Color, |
||||
} |
||||
if err := c.Apply(tt.args.s); (err != nil) != tt.wantErr { |
||||
t.Errorf("Apply() error = %v, wantErr %v", err, tt.wantErr) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestCellColor_MarshalLogObject(t *testing.T) { |
||||
type fields struct { |
||||
At state.StorageCoordinates |
||||
Color state.Color |
||||
} |
||||
type args struct { |
||||
encoder zapcore.ObjectEncoder |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
args args |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := CellColor{ |
||||
At: tt.fields.At, |
||||
Color: tt.fields.Color, |
||||
} |
||||
if err := c.MarshalLogObject(tt.args.encoder); (err != nil) != tt.wantErr { |
||||
t.Errorf("MarshalLogObject() error = %v, wantErr %v", err, tt.wantErr) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestIDed_MarshalLogObject(t *testing.T) { |
||||
type fields struct { |
||||
ID uint32 |
||||
Action Client |
||||
} |
||||
type args struct { |
||||
encoder zapcore.ObjectEncoder |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
args args |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
i := IDed{ |
||||
ID: tt.fields.ID, |
||||
Action: tt.fields.Action, |
||||
} |
||||
if err := i.MarshalLogObject(tt.args.encoder); (err != nil) != tt.wantErr { |
||||
t.Errorf("MarshalLogObject() error = %v, wantErr %v", err, tt.wantErr) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestServerSlice_MarshalLogArray(t *testing.T) { |
||||
type args struct { |
||||
encoder zapcore.ArrayEncoder |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
s ServerSlice |
||||
args args |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
if err := tt.s.MarshalLogArray(tt.args.encoder); (err != nil) != tt.wantErr { |
||||
t.Errorf("MarshalLogArray() error = %v, wantErr %v", err, tt.wantErr) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestUserActiveColor_Apply(t *testing.T) { |
||||
type fields struct { |
||||
Color state.Color |
||||
} |
||||
type args struct { |
||||
s *state.Synced |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
args args |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := UserActiveColor{ |
||||
Color: tt.fields.Color, |
||||
} |
||||
if err := c.Apply(tt.args.s); (err != nil) != tt.wantErr { |
||||
t.Errorf("Apply() error = %v, wantErr %v", err, tt.wantErr) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func TestUserActiveColor_MarshalLogObject(t *testing.T) { |
||||
type fields struct { |
||||
Color state.Color |
||||
} |
||||
type args struct { |
||||
encoder zapcore.ObjectEncoder |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
fields fields |
||||
args args |
||||
wantErr bool |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
c := UserActiveColor{ |
||||
Color: tt.fields.Color, |
||||
} |
||||
if err := c.MarshalLogObject(tt.args.encoder); (err != nil) != tt.wantErr { |
||||
t.Errorf("MarshalLogObject() error = %v, wantErr %v", err, tt.wantErr) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
func Test_serverPBFromClient(t *testing.T) { |
||||
type args struct { |
||||
c Client |
||||
} |
||||
tests := []struct { |
||||
name string |
||||
args args |
||||
want *ServerActionPB |
||||
}{ |
||||
// TODO: Add test cases.
|
||||
} |
||||
for _, tt := range tests { |
||||
t.Run(tt.name, func(t *testing.T) { |
||||
if got := serverPBFromClient(tt.args.c); !reflect.DeepEqual(got, tt.want) { |
||||
t.Errorf("serverPBFromClient() = %v, want %v", got, tt.want) |
||||
} |
||||
}) |
||||
} |
||||
} |
Loading…
Reference in new issue