github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/zrealm5.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("key1"), "value1")
    18  	println(updated, tree.Size())
    19  }
    20  
    21  // Output:
    22  // false 2
    23  
    24  // Realm:
    25  // switchrealm["gno.land/r/test"]
    26  // c[a8ada09dee16d791fd406d629fe29bb0ed084a30:5]={
    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": "key1"
    36  //             }
    37  //         },
    38  //         {
    39  //             "T": {
    40  //                 "@type": "/gno.PrimitiveType",
    41  //                 "value": "16"
    42  //             },
    43  //             "V": {
    44  //                 "@type": "/gno.StringValue",
    45  //                 "value": "value1"
    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:5",
    76  //         "ModTime": "0",
    77  //         "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4",
    78  //         "RefCount": "1"
    79  //     }
    80  // }
    81  // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]={
    82  //     "Fields": [
    83  //         {
    84  //             "T": {
    85  //                 "@type": "/gno.RefType",
    86  //                 "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/types.String"
    87  //             },
    88  //             "V": {
    89  //                 "@type": "/gno.StringValue",
    90  //                 "value": "key0"
    91  //             }
    92  //         },
    93  //         {
    94  //             "T": {
    95  //                 "@type": "/gno.PrimitiveType",
    96  //                 "value": "16"
    97  //             },
    98  //             "V": {
    99  //                 "@type": "/gno.StringValue",
   100  //                 "value": "value0"
   101  //             }
   102  //         },
   103  //         {
   104  //             "N": "AgAAAAAAAAA=",
   105  //             "T": {
   106  //                 "@type": "/gno.PrimitiveType",
   107  //                 "value": "32"
   108  //             }
   109  //         },
   110  //         {
   111  //             "T": {
   112  //                 "@type": "/gno.PointerType",
   113  //                 "Elt": {
   114  //                     "@type": "/gno.RefType",
   115  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   116  //                 }
   117  //             }
   118  //         },
   119  //         {
   120  //             "T": {
   121  //                 "@type": "/gno.PointerType",
   122  //                 "Elt": {
   123  //                     "@type": "/gno.RefType",
   124  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   125  //                 }
   126  //             },
   127  //             "V": {
   128  //                 "@type": "/gno.PointerValue",
   129  //                 "Base": null,
   130  //                 "Index": "0",
   131  //                 "TV": {
   132  //                     "T": {
   133  //                         "@type": "/gno.RefType",
   134  //                         "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   135  //                     },
   136  //                     "V": {
   137  //                         "@type": "/gno.RefValue",
   138  //                         "Hash": "1a4158d473290431f9d4f9c5a85a3b6697640f2a",
   139  //                         "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5"
   140  //                     }
   141  //                 }
   142  //             }
   143  //         }
   144  //     ],
   145  //     "ObjectInfo": {
   146  //         "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4",
   147  //         "ModTime": "4",
   148  //         "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
   149  //         "RefCount": "1"
   150  //     }
   151  // }
   152  // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={
   153  //     "Blank": {},
   154  //     "ObjectInfo": {
   155  //         "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2",
   156  //         "IsEscaped": true,
   157  //         "ModTime": "4",
   158  //         "RefCount": "2"
   159  //     },
   160  //     "Parent": null,
   161  //     "Source": {
   162  //         "@type": "/gno.RefNode",
   163  //         "BlockNode": null,
   164  //         "Location": {
   165  //             "File": "",
   166  //             "Line": "0",
   167  //             "Nonce": "0",
   168  //             "PkgPath": "gno.land/r/test"
   169  //         }
   170  //     },
   171  //     "Values": [
   172  //         {
   173  //             "T": {
   174  //                 "@type": "/gno.FuncType",
   175  //                 "Params": [],
   176  //                 "Results": []
   177  //             },
   178  //             "V": {
   179  //                 "@type": "/gno.FuncValue",
   180  //                 "Closure": {
   181  //                     "@type": "/gno.RefValue",
   182  //                     "Escaped": true,
   183  //                     "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
   184  //                 },
   185  //                 "FileName": "main.gno",
   186  //                 "IsMethod": false,
   187  //                 "Name": "init.0",
   188  //                 "NativeName": "",
   189  //                 "NativePkg": "",
   190  //                 "PkgPath": "gno.land/r/test",
   191  //                 "Source": {
   192  //                     "@type": "/gno.RefNode",
   193  //                     "BlockNode": null,
   194  //                     "Location": {
   195  //                         "File": "main.gno",
   196  //                         "Line": "11",
   197  //                         "Nonce": "0",
   198  //                         "PkgPath": "gno.land/r/test"
   199  //                     }
   200  //                 },
   201  //                 "Type": {
   202  //                     "@type": "/gno.FuncType",
   203  //                     "Params": [],
   204  //                     "Results": []
   205  //                 }
   206  //             }
   207  //         },
   208  //         {
   209  //             "T": {
   210  //                 "@type": "/gno.FuncType",
   211  //                 "Params": [],
   212  //                 "Results": []
   213  //             },
   214  //             "V": {
   215  //                 "@type": "/gno.FuncValue",
   216  //                 "Closure": {
   217  //                     "@type": "/gno.RefValue",
   218  //                     "Escaped": true,
   219  //                     "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
   220  //                 },
   221  //                 "FileName": "main.gno",
   222  //                 "IsMethod": false,
   223  //                 "Name": "main",
   224  //                 "NativeName": "",
   225  //                 "NativePkg": "",
   226  //                 "PkgPath": "gno.land/r/test",
   227  //                 "Source": {
   228  //                     "@type": "/gno.RefNode",
   229  //                     "BlockNode": null,
   230  //                     "Location": {
   231  //                         "File": "main.gno",
   232  //                         "Line": "15",
   233  //                         "Nonce": "0",
   234  //                         "PkgPath": "gno.land/r/test"
   235  //                     }
   236  //                 },
   237  //                 "Type": {
   238  //                     "@type": "/gno.FuncType",
   239  //                     "Params": [],
   240  //                     "Results": []
   241  //                 }
   242  //             }
   243  //         },
   244  //         {
   245  //             "T": {
   246  //                 "@type": "/gno.PointerType",
   247  //                 "Elt": {
   248  //                     "@type": "/gno.RefType",
   249  //                     "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   250  //                 }
   251  //             },
   252  //             "V": {
   253  //                 "@type": "/gno.PointerValue",
   254  //                 "Base": null,
   255  //                 "Index": "0",
   256  //                 "TV": {
   257  //                     "T": {
   258  //                         "@type": "/gno.RefType",
   259  //                         "ID": "github.com/gnolang/gno/_test/timtadh/data_structures/tree/avl.AvlNode"
   260  //                     },
   261  //                     "V": {
   262  //                         "@type": "/gno.RefValue",
   263  //                         "Hash": "011a2960ff92aedda8acd122b9f4d251902e0cd8",
   264  //                         "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:4"
   265  //                     }
   266  //                 }
   267  //             }
   268  //         }
   269  //     ]
   270  // }