]> git.giacomolli.uk - onechat/blobdiff - view_test.go
Order model and chat declarations
[onechat] / view_test.go
index 46f76dade8f9fa6102909d3616f8b090bf61d43e..f771eb29801b25955c039a9755491906795d2ff4 100644 (file)
@@ -149,14 +149,6 @@ func TestRestoreViewRejectsAGap(t *testing.T) {
 // ViewBuiltTree is a tree with each node built, with 1 byte of text.
 type ViewBuiltTree struct{}
 
-func (v ViewBuiltTree) Built(_, _ int) (bool, error) {
-       return true, nil
-}
-
-func (ViewBuiltTree) Node(level, index int) (Node, bool, error) {
-       return treeTestNode(level, index, "a"), true, nil
-}
-
 // ViewPushEntry is one entry of the rollback state list of the reference
 // design, newest first. Under push alone, life stays 0, so the entry leaves it
 // out.
@@ -166,6 +158,19 @@ type ViewPushEntry struct {
        older *ViewPushEntry
 }
 
+// ViewPartTree is a tree with the built nodes of its sizes.
+type ViewPartTree struct {
+       sizes map[NodeKey]int
+}
+
+func (v ViewBuiltTree) Built(_, _ int) (bool, error) {
+       return true, nil
+}
+
+func (ViewBuiltTree) Node(level, index int) (Node, bool, error) {
+       return treeTestNode(level, index, "a"), true, nil
+}
+
 // starts returns the states of the list, oldest first.
 func (e *ViewPushEntry) starts() []int {
        var starts []int
@@ -179,11 +184,6 @@ func (e *ViewPushEntry) starts() []int {
        return starts
 }
 
-// ViewPartTree is a tree with the built nodes of its sizes.
-type ViewPartTree struct {
-       sizes map[NodeKey]int
-}
-
 func (p ViewPartTree) Built(level, index int) (bool, error) {
        _, built := p.sizes[NodeKey{level, index}]
        return built, nil