v2 / vlib / v / tests / options / option_selector_unwrap_test.v
31 lines · 26 sloc · 502 bytes · 3d302a6dad1d1d9ac7b9492ffda488c762e766e4
Raw
1import datatypes { DoublyLinkedList }
2
3pub type LayoutBoxId = usize
4
5pub struct LayoutBox {
6}
7
8pub struct LayoutTree {
9mut:
10 root ?LayoutBoxId
11 boxes []LayoutBox
12}
13
14pub fn LayoutTree.new() LayoutTree {
15 return LayoutTree{
16 root: ?LayoutBoxId(none)
17 boxes: []LayoutBox{}
18 }
19}
20
21fn test_main() {
22 mut tree := LayoutTree.new()
23 tree.root = 1
24 if tree.root != none {
25 mut parents := DoublyLinkedList[LayoutBoxId]{}
26 parents.push_back(tree.root)
27 assert parents.len == 1
28 } else {
29 assert false
30 }
31}
32