Mercurial > hg > Members > tatsuki > bench > jungle-core
changeset 70:053c9b52a5b2
testProgram error fix
author | one |
---|---|
date | Wed, 20 Aug 2014 18:10:30 +0900 |
parents | a822cd7a1aa7 |
children | 5dbae471a3b3 |
files | src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/TraverserTest.java |
diffstat | 2 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Wed Aug 20 14:54:52 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/core/impl/treeeditor/DefaultTreeEditorTest.java Wed Aug 20 18:10:30 2014 +0900 @@ -3,7 +3,6 @@ import java.nio.ByteBuffer; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultTreeEditor; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TraversableNodeWrapper; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.AppendChildAt; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.trasnformer.PutAttribute; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.tests.util.TestUtil; @@ -51,11 +50,11 @@ DefaultTraverser traverser = new DefaultTraverser(); for(DefaultNodePath part : path.inits()){ - Either<Error,Traversal<TraversableNodeWrapper<DefaultTreeNode>>> either = traverser.traverse(new TraversableNodeWrapper<DefaultTreeNode>(newRoot),new DefaultEvaluator(part)); + Either<Error,Traversal<DefaultTreeNode>> either = traverser.traverse(newRoot,new DefaultEvaluator(part)); if(either.isA()){ Assert.fail(); } - DefaultTreeNode target = either.b().destination().getWrapped(); + DefaultTreeNode target = either.b().destination(); String expected = part.toString(); String actual = new String(target.getAttributes().get(key).array()); @@ -63,11 +62,11 @@ } for(DefaultNodePath part : path.inits()){ - Either<Error,Traversal<TraversableNodeWrapper<DefaultTreeNode>>> either = traverser.traverse(new TraversableNodeWrapper<DefaultTreeNode>(oldRoot),new DefaultEvaluator(part)); + Either<Error,Traversal<DefaultTreeNode>> either = traverser.traverse(oldRoot,new DefaultEvaluator(part)); if(either.isA()){ Assert.fail(); } - DefaultTreeNode target = either.b().destination().getWrapped(); + DefaultTreeNode target = either.b().destination(); ByteBuffer actual = target.getAttributes().get(key); Assert.assertNull(actual);
--- a/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/TraverserTest.java Wed Aug 20 14:54:52 2014 +0900 +++ b/src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/traverse/TraverserTest.java Wed Aug 20 18:10:30 2014 +0900 @@ -1,14 +1,14 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverse; import java.nio.ByteBuffer; + import org.junit.Assert; import fj.data.List; - import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath; -import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TraversableNodeWrapper; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.DefaultEvaluator; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.traverser.Direction; @@ -27,7 +27,7 @@ int maxHeight = 3; DefaultTreeNode root = createTree(0,0,maxHeight,new DefaultNodePath()); - TraversableNodeWrapper<DefaultTreeNode> traversable = new TraversableNodeWrapper<DefaultTreeNode>(root); + //TraversableNodeWrapper<DefaultTreeNode> traversable = new TraversableNodeWrapper<DefaultTreeNode>(root); Traverser traverser = instance(); // generate all pattern. @@ -36,24 +36,24 @@ for(DefaultNodePath path : paths){ DefaultEvaluator evaluator = new DefaultEvaluator(path); - Either<Error,Traversal<TraversableNodeWrapper<DefaultTreeNode>>> ret = traverser.traverse(traversable,evaluator); + Either<Error,Traversal<DefaultTreeNode>> ret = traverser.traverse(root,evaluator); if(ret.isA()){ Assert.fail(); } - Traversal<TraversableNodeWrapper<DefaultTreeNode>> traversal = ret.b(); - TraversableNodeWrapper<DefaultTreeNode> target = traversal.destination(); + Traversal<DefaultTreeNode> traversal = ret.b(); + TreeNode target = traversal.destination(); String expect = path.toString(); - ByteBuffer value = target.getWrapped().getAttributes().get(key); + ByteBuffer value = target.getAttributes().get(key); String actual = new String(value.array()); Assert.assertEquals(expect,actual); List<DefaultNodePath> parts = path.inits(); - for(Direction<TraversableNodeWrapper<DefaultTreeNode>> d : traversal){ + for(Direction<DefaultTreeNode> d : traversal){ DefaultNodePath part = parts.head(); parts = parts.tail(); - value = d.getTarget().getWrapped().getAttributes().get(key); + value = d.getTarget().getAttributes().get(key); String actualCurrentPathStr = new String(value.array()); String expectCurrentPathStr = part.toString(); Assert.assertEquals(expectCurrentPathStr,actualCurrentPathStr);