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