Mercurial > hg > Database > jungle-sharp
comparison src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/DefaultJungleTreeTest.cs @ 17:01a08cf4b2d9
Liq Files
author | Kazuma |
---|---|
date | Mon, 07 Nov 2016 01:05:24 +0900 |
parents | b71d9ea6bd8e |
children |
comparison
equal
deleted
inserted
replaced
16:8f1ce942abfc | 17:01a08cf4b2d9 |
---|---|
1 using UnityEngine; | |
2 using System; | |
3 //using System.Diagnostics; | |
4 | |
5 public class DefaultJungleTreeTest : MonoBehaviour { | |
6 // apiの仕様的にこんな感じ | |
7 private readonly int COUNT = 500; | |
8 | |
9 public string key = "moumou"; | |
10 private byte[] value = BitConverter.GetBytes(10); | |
11 | |
12 public void Start () { | |
13 Jungle j = new DefaultJungle(null, "hoge", new DefaultTreeEditor(new DefaultTraverser())); | |
14 JungleTree t = j.createNewTree("tree"); | |
15 | |
16 JungleTreeEditor editor1 = t.getTreeEditor(); | |
17 | |
18 DefaultNodePath root = new DefaultNodePath(); | |
19 NodePath path = root.add(0); | |
20 // NodePath path = root.pop().rights(); | |
21 | |
22 print(path.ToString()); | |
23 | |
24 | |
25 float check_time = Time.realtimeSinceStartup; | |
26 | |
27 for(int i = 0; i < COUNT; i++) { | |
28 Either<Error, JungleTreeEditor> either = editor1.putAttribute(root, i.ToString(), value); | |
29 if (either.isA()) { | |
30 Debug.Log("失敗しました。"); | |
31 } | |
32 editor1 = either.b (); | |
33 | |
34 Either<Error, JungleTreeEditor> r = editor1.success(); | |
35 if (!r.isA()) { | |
36 Debug.Log("失敗しました。"); | |
37 } | |
38 r.b(); | |
39 } | |
40 check_time = Time.realtimeSinceStartup - check_time; | |
41 print ("処理時間 : " + check_time); | |
42 | |
43 TreeNode node = t.getRootNode(); | |
44 for (int i = 0; i < COUNT; i++) { | |
45 byte[] v = node.getAttributes ().get (i.ToString()); | |
46 print (BitConverter.ToInt32 (v, 0)); | |
47 } | |
48 } | |
49 | |
50 } |