github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/zrealm6.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  	tree, _ = tree.Put(types.String("key1"), "value1")
    14  }
    15  
    16  func main() {
    17  	var updated bool
    18  	tree, updated = tree.Put(types.String("key3"), "value3")
    19  	println(updated, tree.Size())
    20  }
    21  
    22  // Output:
    23  // false 3
    24  
    25  // Realm:
    26  // switchrealm["gno.land/r/test"]
    27  // c[a8ada09dee16d791fd406d629fe29bb0ed084a30:6]={
    28  //     "Fields": [
    29  //         {
    30  //             "T": {
    31  //                 "@type": "/gno.RefType",
    32  //                 "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/types.String"
    33  //             },
    34  //             "V": {
    35  //                 "@type": "/gno.StringValue",
    36  //                 "value": "key3"
    37  //             }
    38  //         },
    39  //         {
    40  //             "T": {
    41  //                 "@type": "/gno.PrimitiveType",
    42  //                 "value": "16"
    43  //             },
    44  //             "V": {
    45  //                 "@type": "/gno.StringValue",
    46  //                 "value": "value3"
    47  //             }
    48  //         },
    49  //         {
    50  //             "N": "AQAAAAAAAAA=",
    51  //             "T": {
    52  //                 "@type": "/gno.PrimitiveType",
    53  //                 "value": "32"
    54  //             }
    55  //         },
    56  //         {
    57  //             "T": {
    58  //                 "@type": "/gno.PointerType",
    59  //                 "Elt": {
    60  //                     "@type": "/gno.RefType",
    61  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
    62  //                 }
    63  //             }
    64  //         },
    65  //         {
    66  //             "T": {
    67  //                 "@type": "/gno.PointerType",
    68  //                 "Elt": {
    69  //                     "@type": "/gno.RefType",
    70  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
    71  //                 }
    72  //             }
    73  //         }
    74  //     ],
    75  //     "ObjectInfo": {
    76  //         "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:6",
    77  //         "ModTime": "0",
    78  //         "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5",
    79  //         "RefCount": "1"
    80  //     }
    81  // }
    82  // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:5]={
    83  //     "Fields": [
    84  //         {
    85  //             "T": {
    86  //                 "@type": "/gno.RefType",
    87  //                 "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/types.String"
    88  //             },
    89  //             "V": {
    90  //                 "@type": "/gno.StringValue",
    91  //                 "value": "key1"
    92  //             }
    93  //         },
    94  //         {
    95  //             "T": {
    96  //                 "@type": "/gno.PrimitiveType",
    97  //                 "value": "16"
    98  //             },
    99  //             "V": {
   100  //                 "@type": "/gno.StringValue",
   101  //                 "value": "value1"
   102  //             }
   103  //         },
   104  //         {
   105  //             "N": "AgAAAAAAAAA=",
   106  //             "T": {
   107  //                 "@type": "/gno.PrimitiveType",
   108  //                 "value": "32"
   109  //             }
   110  //         },
   111  //         {
   112  //             "T": {
   113  //                 "@type": "/gno.PointerType",
   114  //                 "Elt": {
   115  //                     "@type": "/gno.RefType",
   116  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   117  //                 }
   118  //             }
   119  //         },
   120  //         {
   121  //             "T": {
   122  //                 "@type": "/gno.PointerType",
   123  //                 "Elt": {
   124  //                     "@type": "/gno.RefType",
   125  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   126  //                 }
   127  //             },
   128  //             "V": {
   129  //                 "@type": "/gno.PointerValue",
   130  //                 "Base": null,
   131  //                 "Index": "0",
   132  //                 "TV": {
   133  //                     "T": {
   134  //                         "@type": "/gno.RefType",
   135  //                         "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   136  //                     },
   137  //                     "V": {
   138  //                         "@type": "/gno.RefValue",
   139  //                         "Hash": "b1719c55a9b07d432385f020b0bdbc678ba2b9ac",
   140  //                         "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:6"
   141  //                     }
   142  //                 }
   143  //             }
   144  //         }
   145  //     ],
   146  //     "ObjectInfo": {
   147  //         "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5",
   148  //         "ModTime": "5",
   149  //         "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4",
   150  //         "RefCount": "1"
   151  //     }
   152  // }
   153  // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]={
   154  //     "Fields": [
   155  //         {
   156  //             "T": {
   157  //                 "@type": "/gno.RefType",
   158  //                 "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/types.String"
   159  //             },
   160  //             "V": {
   161  //                 "@type": "/gno.StringValue",
   162  //                 "value": "key0"
   163  //             }
   164  //         },
   165  //         {
   166  //             "T": {
   167  //                 "@type": "/gno.PrimitiveType",
   168  //                 "value": "16"
   169  //             },
   170  //             "V": {
   171  //                 "@type": "/gno.StringValue",
   172  //                 "value": "value0"
   173  //             }
   174  //         },
   175  //         {
   176  //             "N": "AwAAAAAAAAA=",
   177  //             "T": {
   178  //                 "@type": "/gno.PrimitiveType",
   179  //                 "value": "32"
   180  //             }
   181  //         },
   182  //         {
   183  //             "T": {
   184  //                 "@type": "/gno.PointerType",
   185  //                 "Elt": {
   186  //                     "@type": "/gno.RefType",
   187  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   188  //                 }
   189  //             }
   190  //         },
   191  //         {
   192  //             "T": {
   193  //                 "@type": "/gno.PointerType",
   194  //                 "Elt": {
   195  //                     "@type": "/gno.RefType",
   196  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   197  //                 }
   198  //             },
   199  //             "V": {
   200  //                 "@type": "/gno.PointerValue",
   201  //                 "Base": null,
   202  //                 "Index": "0",
   203  //                 "TV": {
   204  //                     "T": {
   205  //                         "@type": "/gno.RefType",
   206  //                         "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   207  //                     },
   208  //                     "V": {
   209  //                         "@type": "/gno.RefValue",
   210  //                         "Hash": "8d00c3fa6c15cb0d78dcbaa23df49f96bbc9591b",
   211  //                         "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5"
   212  //                     }
   213  //                 }
   214  //             }
   215  //         }
   216  //     ],
   217  //     "ObjectInfo": {
   218  //         "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4",
   219  //         "ModTime": "5",
   220  //         "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
   221  //         "RefCount": "1"
   222  //     }
   223  // }
   224  // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={
   225  //     "Blank": {},
   226  //     "ObjectInfo": {
   227  //         "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
   228  //         "IsEscaped": true,
   229  //         "ModTime": "5",
   230  //         "RefCount": "2"
   231  //     },
   232  //     "Parent": null,
   233  //     "Source": {
   234  //         "@type": "/gno.RefNode",
   235  //         "BlockNode": null,
   236  //         "Location": {
   237  //             "File": "",
   238  //             "Line": "0",
   239  //             "Nonce": "0",
   240  //             "PkgPath": "gno.land/r/test"
   241  //         }
   242  //     },
   243  //     "Values": [
   244  //         {
   245  //             "T": {
   246  //                 "@type": "/gno.FuncType",
   247  //                 "Params": [],
   248  //                 "Results": []
   249  //             },
   250  //             "V": {
   251  //                 "@type": "/gno.FuncValue",
   252  //                 "Closure": {
   253  //                     "@type": "/gno.RefValue",
   254  //                     "Escaped": true,
   255  //                     "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
   256  //                 },
   257  //                 "FileName": "main.gno",
   258  //                 "IsMethod": false,
   259  //                 "Name": "init.0",
   260  //                 "NativeName": "",
   261  //                 "NativePkg": "",
   262  //                 "PkgPath": "gno.land/r/test",
   263  //                 "Source": {
   264  //                     "@type": "/gno.RefNode",
   265  //                     "BlockNode": null,
   266  //                     "Location": {
   267  //                         "File": "main.gno",
   268  //                         "Line": "11",
   269  //                         "Nonce": "0",
   270  //                         "PkgPath": "gno.land/r/test"
   271  //                     }
   272  //                 },
   273  //                 "Type": {
   274  //                     "@type": "/gno.FuncType",
   275  //                     "Params": [],
   276  //                     "Results": []
   277  //                 }
   278  //             }
   279  //         },
   280  //         {
   281  //             "T": {
   282  //                 "@type": "/gno.FuncType",
   283  //                 "Params": [],
   284  //                 "Results": []
   285  //             },
   286  //             "V": {
   287  //                 "@type": "/gno.FuncValue",
   288  //                 "Closure": {
   289  //                     "@type": "/gno.RefValue",
   290  //                     "Escaped": true,
   291  //                     "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
   292  //                 },
   293  //                 "FileName": "main.gno",
   294  //                 "IsMethod": false,
   295  //                 "Name": "main",
   296  //                 "NativeName": "",
   297  //                 "NativePkg": "",
   298  //                 "PkgPath": "gno.land/r/test",
   299  //                 "Source": {
   300  //                     "@type": "/gno.RefNode",
   301  //                     "BlockNode": null,
   302  //                     "Location": {
   303  //                         "File": "main.gno",
   304  //                         "Line": "16",
   305  //                         "Nonce": "0",
   306  //                         "PkgPath": "gno.land/r/test"
   307  //                     }
   308  //                 },
   309  //                 "Type": {
   310  //                     "@type": "/gno.FuncType",
   311  //                     "Params": [],
   312  //                     "Results": []
   313  //                 }
   314  //             }
   315  //         },
   316  //         {
   317  //             "T": {
   318  //                 "@type": "/gno.PointerType",
   319  //                 "Elt": {
   320  //                     "@type": "/gno.RefType",
   321  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   322  //                 }
   323  //             },
   324  //             "V": {
   325  //                 "@type": "/gno.PointerValue",
   326  //                 "Base": null,
   327  //                 "Index": "0",
   328  //                 "TV": {
   329  //                     "T": {
   330  //                         "@type": "/gno.RefType",
   331  //                         "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   332  //                     },
   333  //                     "V": {
   334  //                         "@type": "/gno.RefValue",
   335  //                         "Hash": "8f2cb2a771ddc55ab5798b791e16df547c94d862",
   336  //                         "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
   337  //                     }
   338  //                 }
   339  //             }
   340  //         }
   341  //     ]
   342  // }