github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/zrealm4.gno (about) 1 // PKGPATH: gno.land/r/test 2 package test 3 4 import ( 5 "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl" 6 "github.com/gnolang/gno/_test/timtadh/data_structures/types" 7 ) 8 9 var tree *avl.AvlNode 10 11 func init() { 12 tree, _ = tree.Put(types.String("key0"), "value0") 13 } 14 15 func main() { 16 var updated bool 17 tree, updated = tree.Put(types.String("key0"), "value0-new") 18 println(updated, tree.Size()) 19 } 20 21 // Output: 22 // true 1 23 24 // Realm: 25 // switchrealm["gno.land/r/test"] 26 // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]={ 27 // "Fields": [ 28 // { 29 // "T": { 30 // "@type": "/gno.RefType", 31 // "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/types.String" 32 // }, 33 // "V": { 34 // "@type": "/gno.StringValue", 35 // "value": "key0" 36 // } 37 // }, 38 // { 39 // "T": { 40 // "@type": "/gno.PrimitiveType", 41 // "value": "16" 42 // }, 43 // "V": { 44 // "@type": "/gno.StringValue", 45 // "value": "value0-new" 46 // } 47 // }, 48 // { 49 // "N": "AQAAAAAAAAA=", 50 // "T": { 51 // "@type": "/gno.PrimitiveType", 52 // "value": "32" 53 // } 54 // }, 55 // { 56 // "T": { 57 // "@type": "/gno.PointerType", 58 // "Elt": { 59 // "@type": "/gno.RefType", 60 // "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode" 61 // } 62 // } 63 // }, 64 // { 65 // "T": { 66 // "@type": "/gno.PointerType", 67 // "Elt": { 68 // "@type": "/gno.RefType", 69 // "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode" 70 // } 71 // } 72 // } 73 // ], 74 // "ObjectInfo": { 75 // "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4", 76 // "ModTime": "4", 77 // "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2", 78 // "RefCount": "1" 79 // } 80 // } 81 // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={ 82 // "Blank": {}, 83 // "ObjectInfo": { 84 // "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2", 85 // "IsEscaped": true, 86 // "ModTime": "4", 87 // "RefCount": "2" 88 // }, 89 // "Parent": null, 90 // "Source": { 91 // "@type": "/gno.RefNode", 92 // "BlockNode": null, 93 // "Location": { 94 // "File": "", 95 // "Line": "0", 96 // "Nonce": "0", 97 // "PkgPath": "gno.land/r/test" 98 // } 99 // }, 100 // "Values": [ 101 // { 102 // "T": { 103 // "@type": "/gno.FuncType", 104 // "Params": [], 105 // "Results": [] 106 // }, 107 // "V": { 108 // "@type": "/gno.FuncValue", 109 // "Closure": { 110 // "@type": "/gno.RefValue", 111 // "Escaped": true, 112 // "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3" 113 // }, 114 // "FileName": "main.gno", 115 // "IsMethod": false, 116 // "Name": "init.0", 117 // "NativeName": "", 118 // "NativePkg": "", 119 // "PkgPath": "gno.land/r/test", 120 // "Source": { 121 // "@type": "/gno.RefNode", 122 // "BlockNode": null, 123 // "Location": { 124 // "File": "main.gno", 125 // "Line": "11", 126 // "Nonce": "0", 127 // "PkgPath": "gno.land/r/test" 128 // } 129 // }, 130 // "Type": { 131 // "@type": "/gno.FuncType", 132 // "Params": [], 133 // "Results": [] 134 // } 135 // } 136 // }, 137 // { 138 // "T": { 139 // "@type": "/gno.FuncType", 140 // "Params": [], 141 // "Results": [] 142 // }, 143 // "V": { 144 // "@type": "/gno.FuncValue", 145 // "Closure": { 146 // "@type": "/gno.RefValue", 147 // "Escaped": true, 148 // "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3" 149 // }, 150 // "FileName": "main.gno", 151 // "IsMethod": false, 152 // "Name": "main", 153 // "NativeName": "", 154 // "NativePkg": "", 155 // "PkgPath": "gno.land/r/test", 156 // "Source": { 157 // "@type": "/gno.RefNode", 158 // "BlockNode": null, 159 // "Location": { 160 // "File": "main.gno", 161 // "Line": "15", 162 // "Nonce": "0", 163 // "PkgPath": "gno.land/r/test" 164 // } 165 // }, 166 // "Type": { 167 // "@type": "/gno.FuncType", 168 // "Params": [], 169 // "Results": [] 170 // } 171 // } 172 // }, 173 // { 174 // "T": { 175 // "@type": "/gno.PointerType", 176 // "Elt": { 177 // "@type": "/gno.RefType", 178 // "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode" 179 // } 180 // }, 181 // "V": { 182 // "@type": "/gno.PointerValue", 183 // "Base": null, 184 // "Index": "0", 185 // "TV": { 186 // "T": { 187 // "@type": "/gno.RefType", 188 // "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode" 189 // }, 190 // "V": { 191 // "@type": "/gno.RefValue", 192 // "Hash": "de0c4b2dd935220f7d37d10fc9feb1448bfb011d", 193 // "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4" 194 // } 195 // } 196 // } 197 // } 198 // ] 199 // }