PageRenderTime 62ms CodeModel.GetById 30ms app.highlight 5ms RepoModel.GetById 15ms app.codeStats 0ms

/core/engine/testBattleFieldCreate.erl

http://erlbattle.googlecode.com/
Erlang | 43 lines | 34 code | 4 blank | 5 comment | 0 complexity | 3ed1dab149a27346c05fa62f42e47ac7 MD5 | raw file
 1-module(testBattleFieldCreate).
 2-export([test/0]).
 3-include("test.hrl").
 4-include("schema.hrl").
 5
 6%% ??
 7test()->
 8	battlefield:create(),
 9	test10(),
10	test20(),
11	ets:delete(battle_field).
12	
13%%????ID??????
14test10()->
15	%%????
16	?match(none,battlefield:get_soldier(1,"sdf")),
17	%%??????
18	Soldier=#soldier{
19				id={2,?RedSide},
20				position={0,1+2},
21				hp=100,
22				facing=?DirEast,
23				action=?ActionWait,
24				act_effect_time=0,
25				act_sequence=0
26			},
27	?match(Soldier,battlefield:get_soldier(2,?RedSide)).
28
29%%??????????????
30test20()->
31	?match(none,battlefield:get_soldier_by_position({1,14})),
32	?match(none,battlefield:get_soldier_by_position({14,0})),
33	Soldier=#soldier{
34			id={8,?BlueSide},
35			position={14,9},
36			hp=100,
37			facing=?DirWest,
38			action=?ActionWait,
39			act_effect_time=0,
40			act_sequence=0
41			},
42	?match(Soldier,battlefield:get_soldier_by_position({14,9})).
43