How to use Descriptor method of main Package

Best K6 code snippet using main.Descriptor

object_descriptor_mock.go

Source:object_descriptor_mock.go Github

copy

Full Screen

1package artifact2/*3DO NOT EDIT!4This code was generated automatically using github.com/gojuno/minimock v1.95The original interface "ObjectDescriptor" can be found in github.com/insolar/insolar/internal/ledger/artifact6*/7import (8 "sync/atomic"9 "time"10 "github.com/gojuno/minimock"11 insolar "github.com/insolar/insolar/insolar"12)13//ObjectDescriptorMock implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor14type ObjectDescriptorMock struct {15 t minimock.Tester16 ChildPointerFunc func() (r *insolar.ID)17 ChildPointerCounter uint6418 ChildPointerPreCounter uint6419 ChildPointerMock mObjectDescriptorMockChildPointer20 CodeFunc func() (r *insolar.Reference, r1 error)21 CodeCounter uint6422 CodePreCounter uint6423 CodeMock mObjectDescriptorMockCode24 HeadRefFunc func() (r *insolar.Reference)25 HeadRefCounter uint6426 HeadRefPreCounter uint6427 HeadRefMock mObjectDescriptorMockHeadRef28 IsPrototypeFunc func() (r bool)29 IsPrototypeCounter uint6430 IsPrototypePreCounter uint6431 IsPrototypeMock mObjectDescriptorMockIsPrototype32 MemoryFunc func() (r []byte)33 MemoryCounter uint6434 MemoryPreCounter uint6435 MemoryMock mObjectDescriptorMockMemory36 ParentFunc func() (r *insolar.Reference)37 ParentCounter uint6438 ParentPreCounter uint6439 ParentMock mObjectDescriptorMockParent40 PrototypeFunc func() (r *insolar.Reference, r1 error)41 PrototypeCounter uint6442 PrototypePreCounter uint6443 PrototypeMock mObjectDescriptorMockPrototype44 StateIDFunc func() (r *insolar.ID)45 StateIDCounter uint6446 StateIDPreCounter uint6447 StateIDMock mObjectDescriptorMockStateID48}49//NewObjectDescriptorMock returns a mock for github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor50func NewObjectDescriptorMock(t minimock.Tester) *ObjectDescriptorMock {51 m := &ObjectDescriptorMock{t: t}52 if controller, ok := t.(minimock.MockController); ok {53 controller.RegisterMocker(m)54 }55 m.ChildPointerMock = mObjectDescriptorMockChildPointer{mock: m}56 m.CodeMock = mObjectDescriptorMockCode{mock: m}57 m.HeadRefMock = mObjectDescriptorMockHeadRef{mock: m}58 m.IsPrototypeMock = mObjectDescriptorMockIsPrototype{mock: m}59 m.MemoryMock = mObjectDescriptorMockMemory{mock: m}60 m.ParentMock = mObjectDescriptorMockParent{mock: m}61 m.PrototypeMock = mObjectDescriptorMockPrototype{mock: m}62 m.StateIDMock = mObjectDescriptorMockStateID{mock: m}63 return m64}65type mObjectDescriptorMockChildPointer struct {66 mock *ObjectDescriptorMock67 mainExpectation *ObjectDescriptorMockChildPointerExpectation68 expectationSeries []*ObjectDescriptorMockChildPointerExpectation69}70type ObjectDescriptorMockChildPointerExpectation struct {71 result *ObjectDescriptorMockChildPointerResult72}73type ObjectDescriptorMockChildPointerResult struct {74 r *insolar.ID75}76//Expect specifies that invocation of ObjectDescriptor.ChildPointer is expected from 1 to Infinity times77func (m *mObjectDescriptorMockChildPointer) Expect() *mObjectDescriptorMockChildPointer {78 m.mock.ChildPointerFunc = nil79 m.expectationSeries = nil80 if m.mainExpectation == nil {81 m.mainExpectation = &ObjectDescriptorMockChildPointerExpectation{}82 }83 return m84}85//Return specifies results of invocation of ObjectDescriptor.ChildPointer86func (m *mObjectDescriptorMockChildPointer) Return(r *insolar.ID) *ObjectDescriptorMock {87 m.mock.ChildPointerFunc = nil88 m.expectationSeries = nil89 if m.mainExpectation == nil {90 m.mainExpectation = &ObjectDescriptorMockChildPointerExpectation{}91 }92 m.mainExpectation.result = &ObjectDescriptorMockChildPointerResult{r}93 return m.mock94}95//ExpectOnce specifies that invocation of ObjectDescriptor.ChildPointer is expected once96func (m *mObjectDescriptorMockChildPointer) ExpectOnce() *ObjectDescriptorMockChildPointerExpectation {97 m.mock.ChildPointerFunc = nil98 m.mainExpectation = nil99 expectation := &ObjectDescriptorMockChildPointerExpectation{}100 m.expectationSeries = append(m.expectationSeries, expectation)101 return expectation102}103func (e *ObjectDescriptorMockChildPointerExpectation) Return(r *insolar.ID) {104 e.result = &ObjectDescriptorMockChildPointerResult{r}105}106//Set uses given function f as a mock of ObjectDescriptor.ChildPointer method107func (m *mObjectDescriptorMockChildPointer) Set(f func() (r *insolar.ID)) *ObjectDescriptorMock {108 m.mainExpectation = nil109 m.expectationSeries = nil110 m.mock.ChildPointerFunc = f111 return m.mock112}113//ChildPointer implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface114func (m *ObjectDescriptorMock) ChildPointer() (r *insolar.ID) {115 counter := atomic.AddUint64(&m.ChildPointerPreCounter, 1)116 defer atomic.AddUint64(&m.ChildPointerCounter, 1)117 if len(m.ChildPointerMock.expectationSeries) > 0 {118 if counter > uint64(len(m.ChildPointerMock.expectationSeries)) {119 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.ChildPointer.")120 return121 }122 result := m.ChildPointerMock.expectationSeries[counter-1].result123 if result == nil {124 m.t.Fatal("No results are set for the ObjectDescriptorMock.ChildPointer")125 return126 }127 r = result.r128 return129 }130 if m.ChildPointerMock.mainExpectation != nil {131 result := m.ChildPointerMock.mainExpectation.result132 if result == nil {133 m.t.Fatal("No results are set for the ObjectDescriptorMock.ChildPointer")134 }135 r = result.r136 return137 }138 if m.ChildPointerFunc == nil {139 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.ChildPointer.")140 return141 }142 return m.ChildPointerFunc()143}144//ChildPointerMinimockCounter returns a count of ObjectDescriptorMock.ChildPointerFunc invocations145func (m *ObjectDescriptorMock) ChildPointerMinimockCounter() uint64 {146 return atomic.LoadUint64(&m.ChildPointerCounter)147}148//ChildPointerMinimockPreCounter returns the value of ObjectDescriptorMock.ChildPointer invocations149func (m *ObjectDescriptorMock) ChildPointerMinimockPreCounter() uint64 {150 return atomic.LoadUint64(&m.ChildPointerPreCounter)151}152//ChildPointerFinished returns true if mock invocations count is ok153func (m *ObjectDescriptorMock) ChildPointerFinished() bool {154 // if expectation series were set then invocations count should be equal to expectations count155 if len(m.ChildPointerMock.expectationSeries) > 0 {156 return atomic.LoadUint64(&m.ChildPointerCounter) == uint64(len(m.ChildPointerMock.expectationSeries))157 }158 // if main expectation was set then invocations count should be greater than zero159 if m.ChildPointerMock.mainExpectation != nil {160 return atomic.LoadUint64(&m.ChildPointerCounter) > 0161 }162 // if func was set then invocations count should be greater than zero163 if m.ChildPointerFunc != nil {164 return atomic.LoadUint64(&m.ChildPointerCounter) > 0165 }166 return true167}168type mObjectDescriptorMockCode struct {169 mock *ObjectDescriptorMock170 mainExpectation *ObjectDescriptorMockCodeExpectation171 expectationSeries []*ObjectDescriptorMockCodeExpectation172}173type ObjectDescriptorMockCodeExpectation struct {174 result *ObjectDescriptorMockCodeResult175}176type ObjectDescriptorMockCodeResult struct {177 r *insolar.Reference178 r1 error179}180//Expect specifies that invocation of ObjectDescriptor.Code is expected from 1 to Infinity times181func (m *mObjectDescriptorMockCode) Expect() *mObjectDescriptorMockCode {182 m.mock.CodeFunc = nil183 m.expectationSeries = nil184 if m.mainExpectation == nil {185 m.mainExpectation = &ObjectDescriptorMockCodeExpectation{}186 }187 return m188}189//Return specifies results of invocation of ObjectDescriptor.Code190func (m *mObjectDescriptorMockCode) Return(r *insolar.Reference, r1 error) *ObjectDescriptorMock {191 m.mock.CodeFunc = nil192 m.expectationSeries = nil193 if m.mainExpectation == nil {194 m.mainExpectation = &ObjectDescriptorMockCodeExpectation{}195 }196 m.mainExpectation.result = &ObjectDescriptorMockCodeResult{r, r1}197 return m.mock198}199//ExpectOnce specifies that invocation of ObjectDescriptor.Code is expected once200func (m *mObjectDescriptorMockCode) ExpectOnce() *ObjectDescriptorMockCodeExpectation {201 m.mock.CodeFunc = nil202 m.mainExpectation = nil203 expectation := &ObjectDescriptorMockCodeExpectation{}204 m.expectationSeries = append(m.expectationSeries, expectation)205 return expectation206}207func (e *ObjectDescriptorMockCodeExpectation) Return(r *insolar.Reference, r1 error) {208 e.result = &ObjectDescriptorMockCodeResult{r, r1}209}210//Set uses given function f as a mock of ObjectDescriptor.Code method211func (m *mObjectDescriptorMockCode) Set(f func() (r *insolar.Reference, r1 error)) *ObjectDescriptorMock {212 m.mainExpectation = nil213 m.expectationSeries = nil214 m.mock.CodeFunc = f215 return m.mock216}217//Code implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface218func (m *ObjectDescriptorMock) Code() (r *insolar.Reference, r1 error) {219 counter := atomic.AddUint64(&m.CodePreCounter, 1)220 defer atomic.AddUint64(&m.CodeCounter, 1)221 if len(m.CodeMock.expectationSeries) > 0 {222 if counter > uint64(len(m.CodeMock.expectationSeries)) {223 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Code.")224 return225 }226 result := m.CodeMock.expectationSeries[counter-1].result227 if result == nil {228 m.t.Fatal("No results are set for the ObjectDescriptorMock.Code")229 return230 }231 r = result.r232 r1 = result.r1233 return234 }235 if m.CodeMock.mainExpectation != nil {236 result := m.CodeMock.mainExpectation.result237 if result == nil {238 m.t.Fatal("No results are set for the ObjectDescriptorMock.Code")239 }240 r = result.r241 r1 = result.r1242 return243 }244 if m.CodeFunc == nil {245 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Code.")246 return247 }248 return m.CodeFunc()249}250//CodeMinimockCounter returns a count of ObjectDescriptorMock.CodeFunc invocations251func (m *ObjectDescriptorMock) CodeMinimockCounter() uint64 {252 return atomic.LoadUint64(&m.CodeCounter)253}254//CodeMinimockPreCounter returns the value of ObjectDescriptorMock.Code invocations255func (m *ObjectDescriptorMock) CodeMinimockPreCounter() uint64 {256 return atomic.LoadUint64(&m.CodePreCounter)257}258//CodeFinished returns true if mock invocations count is ok259func (m *ObjectDescriptorMock) CodeFinished() bool {260 // if expectation series were set then invocations count should be equal to expectations count261 if len(m.CodeMock.expectationSeries) > 0 {262 return atomic.LoadUint64(&m.CodeCounter) == uint64(len(m.CodeMock.expectationSeries))263 }264 // if main expectation was set then invocations count should be greater than zero265 if m.CodeMock.mainExpectation != nil {266 return atomic.LoadUint64(&m.CodeCounter) > 0267 }268 // if func was set then invocations count should be greater than zero269 if m.CodeFunc != nil {270 return atomic.LoadUint64(&m.CodeCounter) > 0271 }272 return true273}274type mObjectDescriptorMockHeadRef struct {275 mock *ObjectDescriptorMock276 mainExpectation *ObjectDescriptorMockHeadRefExpectation277 expectationSeries []*ObjectDescriptorMockHeadRefExpectation278}279type ObjectDescriptorMockHeadRefExpectation struct {280 result *ObjectDescriptorMockHeadRefResult281}282type ObjectDescriptorMockHeadRefResult struct {283 r *insolar.Reference284}285//Expect specifies that invocation of ObjectDescriptor.HeadRef is expected from 1 to Infinity times286func (m *mObjectDescriptorMockHeadRef) Expect() *mObjectDescriptorMockHeadRef {287 m.mock.HeadRefFunc = nil288 m.expectationSeries = nil289 if m.mainExpectation == nil {290 m.mainExpectation = &ObjectDescriptorMockHeadRefExpectation{}291 }292 return m293}294//Return specifies results of invocation of ObjectDescriptor.HeadRef295func (m *mObjectDescriptorMockHeadRef) Return(r *insolar.Reference) *ObjectDescriptorMock {296 m.mock.HeadRefFunc = nil297 m.expectationSeries = nil298 if m.mainExpectation == nil {299 m.mainExpectation = &ObjectDescriptorMockHeadRefExpectation{}300 }301 m.mainExpectation.result = &ObjectDescriptorMockHeadRefResult{r}302 return m.mock303}304//ExpectOnce specifies that invocation of ObjectDescriptor.HeadRef is expected once305func (m *mObjectDescriptorMockHeadRef) ExpectOnce() *ObjectDescriptorMockHeadRefExpectation {306 m.mock.HeadRefFunc = nil307 m.mainExpectation = nil308 expectation := &ObjectDescriptorMockHeadRefExpectation{}309 m.expectationSeries = append(m.expectationSeries, expectation)310 return expectation311}312func (e *ObjectDescriptorMockHeadRefExpectation) Return(r *insolar.Reference) {313 e.result = &ObjectDescriptorMockHeadRefResult{r}314}315//Set uses given function f as a mock of ObjectDescriptor.HeadRef method316func (m *mObjectDescriptorMockHeadRef) Set(f func() (r *insolar.Reference)) *ObjectDescriptorMock {317 m.mainExpectation = nil318 m.expectationSeries = nil319 m.mock.HeadRefFunc = f320 return m.mock321}322//HeadRef implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface323func (m *ObjectDescriptorMock) HeadRef() (r *insolar.Reference) {324 counter := atomic.AddUint64(&m.HeadRefPreCounter, 1)325 defer atomic.AddUint64(&m.HeadRefCounter, 1)326 if len(m.HeadRefMock.expectationSeries) > 0 {327 if counter > uint64(len(m.HeadRefMock.expectationSeries)) {328 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.HeadRef.")329 return330 }331 result := m.HeadRefMock.expectationSeries[counter-1].result332 if result == nil {333 m.t.Fatal("No results are set for the ObjectDescriptorMock.HeadRef")334 return335 }336 r = result.r337 return338 }339 if m.HeadRefMock.mainExpectation != nil {340 result := m.HeadRefMock.mainExpectation.result341 if result == nil {342 m.t.Fatal("No results are set for the ObjectDescriptorMock.HeadRef")343 }344 r = result.r345 return346 }347 if m.HeadRefFunc == nil {348 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.HeadRef.")349 return350 }351 return m.HeadRefFunc()352}353//HeadRefMinimockCounter returns a count of ObjectDescriptorMock.HeadRefFunc invocations354func (m *ObjectDescriptorMock) HeadRefMinimockCounter() uint64 {355 return atomic.LoadUint64(&m.HeadRefCounter)356}357//HeadRefMinimockPreCounter returns the value of ObjectDescriptorMock.HeadRef invocations358func (m *ObjectDescriptorMock) HeadRefMinimockPreCounter() uint64 {359 return atomic.LoadUint64(&m.HeadRefPreCounter)360}361//HeadRefFinished returns true if mock invocations count is ok362func (m *ObjectDescriptorMock) HeadRefFinished() bool {363 // if expectation series were set then invocations count should be equal to expectations count364 if len(m.HeadRefMock.expectationSeries) > 0 {365 return atomic.LoadUint64(&m.HeadRefCounter) == uint64(len(m.HeadRefMock.expectationSeries))366 }367 // if main expectation was set then invocations count should be greater than zero368 if m.HeadRefMock.mainExpectation != nil {369 return atomic.LoadUint64(&m.HeadRefCounter) > 0370 }371 // if func was set then invocations count should be greater than zero372 if m.HeadRefFunc != nil {373 return atomic.LoadUint64(&m.HeadRefCounter) > 0374 }375 return true376}377type mObjectDescriptorMockIsPrototype struct {378 mock *ObjectDescriptorMock379 mainExpectation *ObjectDescriptorMockIsPrototypeExpectation380 expectationSeries []*ObjectDescriptorMockIsPrototypeExpectation381}382type ObjectDescriptorMockIsPrototypeExpectation struct {383 result *ObjectDescriptorMockIsPrototypeResult384}385type ObjectDescriptorMockIsPrototypeResult struct {386 r bool387}388//Expect specifies that invocation of ObjectDescriptor.IsPrototype is expected from 1 to Infinity times389func (m *mObjectDescriptorMockIsPrototype) Expect() *mObjectDescriptorMockIsPrototype {390 m.mock.IsPrototypeFunc = nil391 m.expectationSeries = nil392 if m.mainExpectation == nil {393 m.mainExpectation = &ObjectDescriptorMockIsPrototypeExpectation{}394 }395 return m396}397//Return specifies results of invocation of ObjectDescriptor.IsPrototype398func (m *mObjectDescriptorMockIsPrototype) Return(r bool) *ObjectDescriptorMock {399 m.mock.IsPrototypeFunc = nil400 m.expectationSeries = nil401 if m.mainExpectation == nil {402 m.mainExpectation = &ObjectDescriptorMockIsPrototypeExpectation{}403 }404 m.mainExpectation.result = &ObjectDescriptorMockIsPrototypeResult{r}405 return m.mock406}407//ExpectOnce specifies that invocation of ObjectDescriptor.IsPrototype is expected once408func (m *mObjectDescriptorMockIsPrototype) ExpectOnce() *ObjectDescriptorMockIsPrototypeExpectation {409 m.mock.IsPrototypeFunc = nil410 m.mainExpectation = nil411 expectation := &ObjectDescriptorMockIsPrototypeExpectation{}412 m.expectationSeries = append(m.expectationSeries, expectation)413 return expectation414}415func (e *ObjectDescriptorMockIsPrototypeExpectation) Return(r bool) {416 e.result = &ObjectDescriptorMockIsPrototypeResult{r}417}418//Set uses given function f as a mock of ObjectDescriptor.IsPrototype method419func (m *mObjectDescriptorMockIsPrototype) Set(f func() (r bool)) *ObjectDescriptorMock {420 m.mainExpectation = nil421 m.expectationSeries = nil422 m.mock.IsPrototypeFunc = f423 return m.mock424}425//IsPrototype implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface426func (m *ObjectDescriptorMock) IsPrototype() (r bool) {427 counter := atomic.AddUint64(&m.IsPrototypePreCounter, 1)428 defer atomic.AddUint64(&m.IsPrototypeCounter, 1)429 if len(m.IsPrototypeMock.expectationSeries) > 0 {430 if counter > uint64(len(m.IsPrototypeMock.expectationSeries)) {431 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.IsPrototype.")432 return433 }434 result := m.IsPrototypeMock.expectationSeries[counter-1].result435 if result == nil {436 m.t.Fatal("No results are set for the ObjectDescriptorMock.IsPrototype")437 return438 }439 r = result.r440 return441 }442 if m.IsPrototypeMock.mainExpectation != nil {443 result := m.IsPrototypeMock.mainExpectation.result444 if result == nil {445 m.t.Fatal("No results are set for the ObjectDescriptorMock.IsPrototype")446 }447 r = result.r448 return449 }450 if m.IsPrototypeFunc == nil {451 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.IsPrototype.")452 return453 }454 return m.IsPrototypeFunc()455}456//IsPrototypeMinimockCounter returns a count of ObjectDescriptorMock.IsPrototypeFunc invocations457func (m *ObjectDescriptorMock) IsPrototypeMinimockCounter() uint64 {458 return atomic.LoadUint64(&m.IsPrototypeCounter)459}460//IsPrototypeMinimockPreCounter returns the value of ObjectDescriptorMock.IsPrototype invocations461func (m *ObjectDescriptorMock) IsPrototypeMinimockPreCounter() uint64 {462 return atomic.LoadUint64(&m.IsPrototypePreCounter)463}464//IsPrototypeFinished returns true if mock invocations count is ok465func (m *ObjectDescriptorMock) IsPrototypeFinished() bool {466 // if expectation series were set then invocations count should be equal to expectations count467 if len(m.IsPrototypeMock.expectationSeries) > 0 {468 return atomic.LoadUint64(&m.IsPrototypeCounter) == uint64(len(m.IsPrototypeMock.expectationSeries))469 }470 // if main expectation was set then invocations count should be greater than zero471 if m.IsPrototypeMock.mainExpectation != nil {472 return atomic.LoadUint64(&m.IsPrototypeCounter) > 0473 }474 // if func was set then invocations count should be greater than zero475 if m.IsPrototypeFunc != nil {476 return atomic.LoadUint64(&m.IsPrototypeCounter) > 0477 }478 return true479}480type mObjectDescriptorMockMemory struct {481 mock *ObjectDescriptorMock482 mainExpectation *ObjectDescriptorMockMemoryExpectation483 expectationSeries []*ObjectDescriptorMockMemoryExpectation484}485type ObjectDescriptorMockMemoryExpectation struct {486 result *ObjectDescriptorMockMemoryResult487}488type ObjectDescriptorMockMemoryResult struct {489 r []byte490}491//Expect specifies that invocation of ObjectDescriptor.Memory is expected from 1 to Infinity times492func (m *mObjectDescriptorMockMemory) Expect() *mObjectDescriptorMockMemory {493 m.mock.MemoryFunc = nil494 m.expectationSeries = nil495 if m.mainExpectation == nil {496 m.mainExpectation = &ObjectDescriptorMockMemoryExpectation{}497 }498 return m499}500//Return specifies results of invocation of ObjectDescriptor.Memory501func (m *mObjectDescriptorMockMemory) Return(r []byte) *ObjectDescriptorMock {502 m.mock.MemoryFunc = nil503 m.expectationSeries = nil504 if m.mainExpectation == nil {505 m.mainExpectation = &ObjectDescriptorMockMemoryExpectation{}506 }507 m.mainExpectation.result = &ObjectDescriptorMockMemoryResult{r}508 return m.mock509}510//ExpectOnce specifies that invocation of ObjectDescriptor.Memory is expected once511func (m *mObjectDescriptorMockMemory) ExpectOnce() *ObjectDescriptorMockMemoryExpectation {512 m.mock.MemoryFunc = nil513 m.mainExpectation = nil514 expectation := &ObjectDescriptorMockMemoryExpectation{}515 m.expectationSeries = append(m.expectationSeries, expectation)516 return expectation517}518func (e *ObjectDescriptorMockMemoryExpectation) Return(r []byte) {519 e.result = &ObjectDescriptorMockMemoryResult{r}520}521//Set uses given function f as a mock of ObjectDescriptor.Memory method522func (m *mObjectDescriptorMockMemory) Set(f func() (r []byte)) *ObjectDescriptorMock {523 m.mainExpectation = nil524 m.expectationSeries = nil525 m.mock.MemoryFunc = f526 return m.mock527}528//Memory implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface529func (m *ObjectDescriptorMock) Memory() (r []byte) {530 counter := atomic.AddUint64(&m.MemoryPreCounter, 1)531 defer atomic.AddUint64(&m.MemoryCounter, 1)532 if len(m.MemoryMock.expectationSeries) > 0 {533 if counter > uint64(len(m.MemoryMock.expectationSeries)) {534 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Memory.")535 return536 }537 result := m.MemoryMock.expectationSeries[counter-1].result538 if result == nil {539 m.t.Fatal("No results are set for the ObjectDescriptorMock.Memory")540 return541 }542 r = result.r543 return544 }545 if m.MemoryMock.mainExpectation != nil {546 result := m.MemoryMock.mainExpectation.result547 if result == nil {548 m.t.Fatal("No results are set for the ObjectDescriptorMock.Memory")549 }550 r = result.r551 return552 }553 if m.MemoryFunc == nil {554 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Memory.")555 return556 }557 return m.MemoryFunc()558}559//MemoryMinimockCounter returns a count of ObjectDescriptorMock.MemoryFunc invocations560func (m *ObjectDescriptorMock) MemoryMinimockCounter() uint64 {561 return atomic.LoadUint64(&m.MemoryCounter)562}563//MemoryMinimockPreCounter returns the value of ObjectDescriptorMock.Memory invocations564func (m *ObjectDescriptorMock) MemoryMinimockPreCounter() uint64 {565 return atomic.LoadUint64(&m.MemoryPreCounter)566}567//MemoryFinished returns true if mock invocations count is ok568func (m *ObjectDescriptorMock) MemoryFinished() bool {569 // if expectation series were set then invocations count should be equal to expectations count570 if len(m.MemoryMock.expectationSeries) > 0 {571 return atomic.LoadUint64(&m.MemoryCounter) == uint64(len(m.MemoryMock.expectationSeries))572 }573 // if main expectation was set then invocations count should be greater than zero574 if m.MemoryMock.mainExpectation != nil {575 return atomic.LoadUint64(&m.MemoryCounter) > 0576 }577 // if func was set then invocations count should be greater than zero578 if m.MemoryFunc != nil {579 return atomic.LoadUint64(&m.MemoryCounter) > 0580 }581 return true582}583type mObjectDescriptorMockParent struct {584 mock *ObjectDescriptorMock585 mainExpectation *ObjectDescriptorMockParentExpectation586 expectationSeries []*ObjectDescriptorMockParentExpectation587}588type ObjectDescriptorMockParentExpectation struct {589 result *ObjectDescriptorMockParentResult590}591type ObjectDescriptorMockParentResult struct {592 r *insolar.Reference593}594//Expect specifies that invocation of ObjectDescriptor.Parent is expected from 1 to Infinity times595func (m *mObjectDescriptorMockParent) Expect() *mObjectDescriptorMockParent {596 m.mock.ParentFunc = nil597 m.expectationSeries = nil598 if m.mainExpectation == nil {599 m.mainExpectation = &ObjectDescriptorMockParentExpectation{}600 }601 return m602}603//Return specifies results of invocation of ObjectDescriptor.Parent604func (m *mObjectDescriptorMockParent) Return(r *insolar.Reference) *ObjectDescriptorMock {605 m.mock.ParentFunc = nil606 m.expectationSeries = nil607 if m.mainExpectation == nil {608 m.mainExpectation = &ObjectDescriptorMockParentExpectation{}609 }610 m.mainExpectation.result = &ObjectDescriptorMockParentResult{r}611 return m.mock612}613//ExpectOnce specifies that invocation of ObjectDescriptor.Parent is expected once614func (m *mObjectDescriptorMockParent) ExpectOnce() *ObjectDescriptorMockParentExpectation {615 m.mock.ParentFunc = nil616 m.mainExpectation = nil617 expectation := &ObjectDescriptorMockParentExpectation{}618 m.expectationSeries = append(m.expectationSeries, expectation)619 return expectation620}621func (e *ObjectDescriptorMockParentExpectation) Return(r *insolar.Reference) {622 e.result = &ObjectDescriptorMockParentResult{r}623}624//Set uses given function f as a mock of ObjectDescriptor.Parent method625func (m *mObjectDescriptorMockParent) Set(f func() (r *insolar.Reference)) *ObjectDescriptorMock {626 m.mainExpectation = nil627 m.expectationSeries = nil628 m.mock.ParentFunc = f629 return m.mock630}631//Parent implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface632func (m *ObjectDescriptorMock) Parent() (r *insolar.Reference) {633 counter := atomic.AddUint64(&m.ParentPreCounter, 1)634 defer atomic.AddUint64(&m.ParentCounter, 1)635 if len(m.ParentMock.expectationSeries) > 0 {636 if counter > uint64(len(m.ParentMock.expectationSeries)) {637 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Parent.")638 return639 }640 result := m.ParentMock.expectationSeries[counter-1].result641 if result == nil {642 m.t.Fatal("No results are set for the ObjectDescriptorMock.Parent")643 return644 }645 r = result.r646 return647 }648 if m.ParentMock.mainExpectation != nil {649 result := m.ParentMock.mainExpectation.result650 if result == nil {651 m.t.Fatal("No results are set for the ObjectDescriptorMock.Parent")652 }653 r = result.r654 return655 }656 if m.ParentFunc == nil {657 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Parent.")658 return659 }660 return m.ParentFunc()661}662//ParentMinimockCounter returns a count of ObjectDescriptorMock.ParentFunc invocations663func (m *ObjectDescriptorMock) ParentMinimockCounter() uint64 {664 return atomic.LoadUint64(&m.ParentCounter)665}666//ParentMinimockPreCounter returns the value of ObjectDescriptorMock.Parent invocations667func (m *ObjectDescriptorMock) ParentMinimockPreCounter() uint64 {668 return atomic.LoadUint64(&m.ParentPreCounter)669}670//ParentFinished returns true if mock invocations count is ok671func (m *ObjectDescriptorMock) ParentFinished() bool {672 // if expectation series were set then invocations count should be equal to expectations count673 if len(m.ParentMock.expectationSeries) > 0 {674 return atomic.LoadUint64(&m.ParentCounter) == uint64(len(m.ParentMock.expectationSeries))675 }676 // if main expectation was set then invocations count should be greater than zero677 if m.ParentMock.mainExpectation != nil {678 return atomic.LoadUint64(&m.ParentCounter) > 0679 }680 // if func was set then invocations count should be greater than zero681 if m.ParentFunc != nil {682 return atomic.LoadUint64(&m.ParentCounter) > 0683 }684 return true685}686type mObjectDescriptorMockPrototype struct {687 mock *ObjectDescriptorMock688 mainExpectation *ObjectDescriptorMockPrototypeExpectation689 expectationSeries []*ObjectDescriptorMockPrototypeExpectation690}691type ObjectDescriptorMockPrototypeExpectation struct {692 result *ObjectDescriptorMockPrototypeResult693}694type ObjectDescriptorMockPrototypeResult struct {695 r *insolar.Reference696 r1 error697}698//Expect specifies that invocation of ObjectDescriptor.Prototype is expected from 1 to Infinity times699func (m *mObjectDescriptorMockPrototype) Expect() *mObjectDescriptorMockPrototype {700 m.mock.PrototypeFunc = nil701 m.expectationSeries = nil702 if m.mainExpectation == nil {703 m.mainExpectation = &ObjectDescriptorMockPrototypeExpectation{}704 }705 return m706}707//Return specifies results of invocation of ObjectDescriptor.Prototype708func (m *mObjectDescriptorMockPrototype) Return(r *insolar.Reference, r1 error) *ObjectDescriptorMock {709 m.mock.PrototypeFunc = nil710 m.expectationSeries = nil711 if m.mainExpectation == nil {712 m.mainExpectation = &ObjectDescriptorMockPrototypeExpectation{}713 }714 m.mainExpectation.result = &ObjectDescriptorMockPrototypeResult{r, r1}715 return m.mock716}717//ExpectOnce specifies that invocation of ObjectDescriptor.Prototype is expected once718func (m *mObjectDescriptorMockPrototype) ExpectOnce() *ObjectDescriptorMockPrototypeExpectation {719 m.mock.PrototypeFunc = nil720 m.mainExpectation = nil721 expectation := &ObjectDescriptorMockPrototypeExpectation{}722 m.expectationSeries = append(m.expectationSeries, expectation)723 return expectation724}725func (e *ObjectDescriptorMockPrototypeExpectation) Return(r *insolar.Reference, r1 error) {726 e.result = &ObjectDescriptorMockPrototypeResult{r, r1}727}728//Set uses given function f as a mock of ObjectDescriptor.Prototype method729func (m *mObjectDescriptorMockPrototype) Set(f func() (r *insolar.Reference, r1 error)) *ObjectDescriptorMock {730 m.mainExpectation = nil731 m.expectationSeries = nil732 m.mock.PrototypeFunc = f733 return m.mock734}735//Prototype implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface736func (m *ObjectDescriptorMock) Prototype() (r *insolar.Reference, r1 error) {737 counter := atomic.AddUint64(&m.PrototypePreCounter, 1)738 defer atomic.AddUint64(&m.PrototypeCounter, 1)739 if len(m.PrototypeMock.expectationSeries) > 0 {740 if counter > uint64(len(m.PrototypeMock.expectationSeries)) {741 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Prototype.")742 return743 }744 result := m.PrototypeMock.expectationSeries[counter-1].result745 if result == nil {746 m.t.Fatal("No results are set for the ObjectDescriptorMock.Prototype")747 return748 }749 r = result.r750 r1 = result.r1751 return752 }753 if m.PrototypeMock.mainExpectation != nil {754 result := m.PrototypeMock.mainExpectation.result755 if result == nil {756 m.t.Fatal("No results are set for the ObjectDescriptorMock.Prototype")757 }758 r = result.r759 r1 = result.r1760 return761 }762 if m.PrototypeFunc == nil {763 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.Prototype.")764 return765 }766 return m.PrototypeFunc()767}768//PrototypeMinimockCounter returns a count of ObjectDescriptorMock.PrototypeFunc invocations769func (m *ObjectDescriptorMock) PrototypeMinimockCounter() uint64 {770 return atomic.LoadUint64(&m.PrototypeCounter)771}772//PrototypeMinimockPreCounter returns the value of ObjectDescriptorMock.Prototype invocations773func (m *ObjectDescriptorMock) PrototypeMinimockPreCounter() uint64 {774 return atomic.LoadUint64(&m.PrototypePreCounter)775}776//PrototypeFinished returns true if mock invocations count is ok777func (m *ObjectDescriptorMock) PrototypeFinished() bool {778 // if expectation series were set then invocations count should be equal to expectations count779 if len(m.PrototypeMock.expectationSeries) > 0 {780 return atomic.LoadUint64(&m.PrototypeCounter) == uint64(len(m.PrototypeMock.expectationSeries))781 }782 // if main expectation was set then invocations count should be greater than zero783 if m.PrototypeMock.mainExpectation != nil {784 return atomic.LoadUint64(&m.PrototypeCounter) > 0785 }786 // if func was set then invocations count should be greater than zero787 if m.PrototypeFunc != nil {788 return atomic.LoadUint64(&m.PrototypeCounter) > 0789 }790 return true791}792type mObjectDescriptorMockStateID struct {793 mock *ObjectDescriptorMock794 mainExpectation *ObjectDescriptorMockStateIDExpectation795 expectationSeries []*ObjectDescriptorMockStateIDExpectation796}797type ObjectDescriptorMockStateIDExpectation struct {798 result *ObjectDescriptorMockStateIDResult799}800type ObjectDescriptorMockStateIDResult struct {801 r *insolar.ID802}803//Expect specifies that invocation of ObjectDescriptor.StateID is expected from 1 to Infinity times804func (m *mObjectDescriptorMockStateID) Expect() *mObjectDescriptorMockStateID {805 m.mock.StateIDFunc = nil806 m.expectationSeries = nil807 if m.mainExpectation == nil {808 m.mainExpectation = &ObjectDescriptorMockStateIDExpectation{}809 }810 return m811}812//Return specifies results of invocation of ObjectDescriptor.StateID813func (m *mObjectDescriptorMockStateID) Return(r *insolar.ID) *ObjectDescriptorMock {814 m.mock.StateIDFunc = nil815 m.expectationSeries = nil816 if m.mainExpectation == nil {817 m.mainExpectation = &ObjectDescriptorMockStateIDExpectation{}818 }819 m.mainExpectation.result = &ObjectDescriptorMockStateIDResult{r}820 return m.mock821}822//ExpectOnce specifies that invocation of ObjectDescriptor.StateID is expected once823func (m *mObjectDescriptorMockStateID) ExpectOnce() *ObjectDescriptorMockStateIDExpectation {824 m.mock.StateIDFunc = nil825 m.mainExpectation = nil826 expectation := &ObjectDescriptorMockStateIDExpectation{}827 m.expectationSeries = append(m.expectationSeries, expectation)828 return expectation829}830func (e *ObjectDescriptorMockStateIDExpectation) Return(r *insolar.ID) {831 e.result = &ObjectDescriptorMockStateIDResult{r}832}833//Set uses given function f as a mock of ObjectDescriptor.StateID method834func (m *mObjectDescriptorMockStateID) Set(f func() (r *insolar.ID)) *ObjectDescriptorMock {835 m.mainExpectation = nil836 m.expectationSeries = nil837 m.mock.StateIDFunc = f838 return m.mock839}840//StateID implements github.com/insolar/insolar/internal/ledger/artifact.ObjectDescriptor interface841func (m *ObjectDescriptorMock) StateID() (r *insolar.ID) {842 counter := atomic.AddUint64(&m.StateIDPreCounter, 1)843 defer atomic.AddUint64(&m.StateIDCounter, 1)844 if len(m.StateIDMock.expectationSeries) > 0 {845 if counter > uint64(len(m.StateIDMock.expectationSeries)) {846 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.StateID.")847 return848 }849 result := m.StateIDMock.expectationSeries[counter-1].result850 if result == nil {851 m.t.Fatal("No results are set for the ObjectDescriptorMock.StateID")852 return853 }854 r = result.r855 return856 }857 if m.StateIDMock.mainExpectation != nil {858 result := m.StateIDMock.mainExpectation.result859 if result == nil {860 m.t.Fatal("No results are set for the ObjectDescriptorMock.StateID")861 }862 r = result.r863 return864 }865 if m.StateIDFunc == nil {866 m.t.Fatalf("Unexpected call to ObjectDescriptorMock.StateID.")867 return868 }869 return m.StateIDFunc()870}871//StateIDMinimockCounter returns a count of ObjectDescriptorMock.StateIDFunc invocations872func (m *ObjectDescriptorMock) StateIDMinimockCounter() uint64 {873 return atomic.LoadUint64(&m.StateIDCounter)874}875//StateIDMinimockPreCounter returns the value of ObjectDescriptorMock.StateID invocations876func (m *ObjectDescriptorMock) StateIDMinimockPreCounter() uint64 {877 return atomic.LoadUint64(&m.StateIDPreCounter)878}879//StateIDFinished returns true if mock invocations count is ok880func (m *ObjectDescriptorMock) StateIDFinished() bool {881 // if expectation series were set then invocations count should be equal to expectations count882 if len(m.StateIDMock.expectationSeries) > 0 {883 return atomic.LoadUint64(&m.StateIDCounter) == uint64(len(m.StateIDMock.expectationSeries))884 }885 // if main expectation was set then invocations count should be greater than zero886 if m.StateIDMock.mainExpectation != nil {887 return atomic.LoadUint64(&m.StateIDCounter) > 0888 }889 // if func was set then invocations count should be greater than zero890 if m.StateIDFunc != nil {891 return atomic.LoadUint64(&m.StateIDCounter) > 0892 }893 return true894}895//ValidateCallCounters checks that all mocked methods of the interface have been called at least once896//Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller897func (m *ObjectDescriptorMock) ValidateCallCounters() {898 if !m.ChildPointerFinished() {899 m.t.Fatal("Expected call to ObjectDescriptorMock.ChildPointer")900 }901 if !m.CodeFinished() {902 m.t.Fatal("Expected call to ObjectDescriptorMock.Code")903 }904 if !m.HeadRefFinished() {905 m.t.Fatal("Expected call to ObjectDescriptorMock.HeadRef")906 }907 if !m.IsPrototypeFinished() {908 m.t.Fatal("Expected call to ObjectDescriptorMock.IsPrototype")909 }910 if !m.MemoryFinished() {911 m.t.Fatal("Expected call to ObjectDescriptorMock.Memory")912 }913 if !m.ParentFinished() {914 m.t.Fatal("Expected call to ObjectDescriptorMock.Parent")915 }916 if !m.PrototypeFinished() {917 m.t.Fatal("Expected call to ObjectDescriptorMock.Prototype")918 }919 if !m.StateIDFinished() {920 m.t.Fatal("Expected call to ObjectDescriptorMock.StateID")921 }922}923//CheckMocksCalled checks that all mocked methods of the interface have been called at least once924//Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller925func (m *ObjectDescriptorMock) CheckMocksCalled() {926 m.Finish()927}928//Finish checks that all mocked methods of the interface have been called at least once929//Deprecated: please use MinimockFinish or use Finish method of minimock.Controller930func (m *ObjectDescriptorMock) Finish() {931 m.MinimockFinish()932}933//MinimockFinish checks that all mocked methods of the interface have been called at least once934func (m *ObjectDescriptorMock) MinimockFinish() {935 if !m.ChildPointerFinished() {936 m.t.Fatal("Expected call to ObjectDescriptorMock.ChildPointer")937 }938 if !m.CodeFinished() {939 m.t.Fatal("Expected call to ObjectDescriptorMock.Code")940 }941 if !m.HeadRefFinished() {942 m.t.Fatal("Expected call to ObjectDescriptorMock.HeadRef")943 }944 if !m.IsPrototypeFinished() {945 m.t.Fatal("Expected call to ObjectDescriptorMock.IsPrototype")946 }947 if !m.MemoryFinished() {948 m.t.Fatal("Expected call to ObjectDescriptorMock.Memory")949 }950 if !m.ParentFinished() {951 m.t.Fatal("Expected call to ObjectDescriptorMock.Parent")952 }953 if !m.PrototypeFinished() {954 m.t.Fatal("Expected call to ObjectDescriptorMock.Prototype")955 }956 if !m.StateIDFinished() {957 m.t.Fatal("Expected call to ObjectDescriptorMock.StateID")958 }959}960//Wait waits for all mocked methods to be called at least once961//Deprecated: please use MinimockWait or use Wait method of minimock.Controller962func (m *ObjectDescriptorMock) Wait(timeout time.Duration) {963 m.MinimockWait(timeout)964}965//MinimockWait waits for all mocked methods to be called at least once966//this method is called by minimock.Controller967func (m *ObjectDescriptorMock) MinimockWait(timeout time.Duration) {968 timeoutCh := time.After(timeout)969 for {970 ok := true971 ok = ok && m.ChildPointerFinished()972 ok = ok && m.CodeFinished()973 ok = ok && m.HeadRefFinished()974 ok = ok && m.IsPrototypeFinished()975 ok = ok && m.MemoryFinished()976 ok = ok && m.ParentFinished()977 ok = ok && m.PrototypeFinished()978 ok = ok && m.StateIDFinished()979 if ok {980 return981 }982 select {983 case <-timeoutCh:984 if !m.ChildPointerFinished() {985 m.t.Error("Expected call to ObjectDescriptorMock.ChildPointer")986 }987 if !m.CodeFinished() {988 m.t.Error("Expected call to ObjectDescriptorMock.Code")989 }990 if !m.HeadRefFinished() {991 m.t.Error("Expected call to ObjectDescriptorMock.HeadRef")992 }993 if !m.IsPrototypeFinished() {994 m.t.Error("Expected call to ObjectDescriptorMock.IsPrototype")995 }996 if !m.MemoryFinished() {997 m.t.Error("Expected call to ObjectDescriptorMock.Memory")998 }999 if !m.ParentFinished() {1000 m.t.Error("Expected call to ObjectDescriptorMock.Parent")1001 }1002 if !m.PrototypeFinished() {1003 m.t.Error("Expected call to ObjectDescriptorMock.Prototype")1004 }1005 if !m.StateIDFinished() {1006 m.t.Error("Expected call to ObjectDescriptorMock.StateID")1007 }1008 m.t.Fatalf("Some mocks were not called on time: %s", timeout)1009 return1010 default:1011 time.Sleep(time.Millisecond)1012 }1013 }1014}1015//AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled,1016//it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled())1017func (m *ObjectDescriptorMock) AllMocksCalled() bool {1018 if !m.ChildPointerFinished() {1019 return false1020 }1021 if !m.CodeFinished() {1022 return false1023 }1024 if !m.HeadRefFinished() {1025 return false1026 }1027 if !m.IsPrototypeFinished() {1028 return false1029 }1030 if !m.MemoryFinished() {1031 return false...

Full Screen

Full Screen

premain.go

Source:premain.go Github

copy

Full Screen

1package mainlib2import "os"3import . "github.com/volution/z-run/lib/common"4type MainDescriptor struct {5 6 Main func (_context *MainContext) (*Error)7 8 ExecutableName string9 ExecutableEnvironmentHint string10 11 Flags interface{}12 13 HelpTxt string14 15 ManualTxt string16 ManualHtml string17 ManualMan string18}19type MainContext struct {20 21 Descriptor *MainDescriptor22 23 Executable0 string24 Executable string25 26 Argument0 string27 Arguments []string28 29 EnvironmentMap map[string]string30 EnvironmentList []string31 32 Flags interface{}33}34func PreMainWith (_descriptor *MainDescriptor) () {35 36 if _error := InitializeMainRuntime (); _error != nil {37 panic (AbortError (_error))38 }39 40 LogfTool = _descriptor.ExecutableName41 42 if _error := CleanMainEnvironment (); _error != nil {43 panic (AbortError (_error))44 }45 46 var _executable0, _executable string47 if _executable0_0, _executable_0, _error := ResolveMainExecutable (_descriptor.ExecutableName, _descriptor.ExecutableEnvironmentHint); _error == nil {48 _executable0 = _executable0_049 _executable = _executable_050 } else {51 panic (AbortError (_error))52 }53 54 var _environmentMap map[string]string55 var _environmentList []string56 if _environmentMap_0, _environmentList_0, _error := ResolveMainEnvironment (); _error == nil {57 _environmentMap = _environmentMap_058 _environmentList = _environmentList_059 } else {60 panic (AbortError (_error))61 }62 63 if _error := InterceptMainSpecialFlags (_descriptor.ExecutableName, _executable0, _executable, _descriptor.HelpTxt, _descriptor.ManualTxt, _descriptor.ManualHtml, _descriptor.ManualMan, _environmentMap); _error != nil {64 panic (AbortError (_error))65 }66 67 var _argument0 string68 var _arguments []string69 if _argument0_0, _arguments_0, _error := ResolveMainArguments (_executable0, _executable); _error == nil {70 _argument0 = _argument0_071 _arguments = _arguments_072 } else {73 panic (AbortError (_error))74 }75 76 if _descriptor.Flags != nil {77 if _error := ResolveMainFlags (_descriptor.ExecutableName, _arguments, _environmentMap, _descriptor.Flags, os.Stderr); _error != nil {78 panic (AbortError (_error))79 }80 }81 82 _context := & MainContext {83 84 Descriptor : _descriptor,85 86 Flags : _descriptor.Flags,87 88 Executable0 : _executable0,89 Executable : _executable,90 91 Argument0 : _argument0,92 Arguments : _arguments,93 94 EnvironmentMap : _environmentMap,95 EnvironmentList : _environmentList,96 }97 98 if _error := _descriptor.Main (_context); _error != nil {...

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1func main() {2 fmt.Println("Hello, World!")3 fmt.Println(Descriptor())4}5func main() {6 fmt.Println("Hello, World!")7 fmt.Println(Descriptor())8}9func main() {10 fmt.Println("Hello, World!")11 fmt.Println(Descriptor())12}13func main() {14 fmt.Println("Hello, World!")15 fmt.Println(Descriptor())16}17func main() {18 fmt.Println("Hello, World!")19 fmt.Println(Descriptor())20}21func main() {22 fmt.Println("Hello, World!")23 fmt.Println(Descriptor())24}25func main() {26 fmt.Println("Hello, World!")27 fmt.Println(Descriptor())28}29func main() {30 fmt.Println("Hello, World!")31 fmt.Println(Descriptor())32}33func main() {34 fmt.Println("Hello, World!")35 fmt.Println(Descriptor())36}37func main() {38 fmt.Println("Hello, World!")39 fmt.Println(Descriptor())40}41func main() {42 fmt.Println("Hello, World!")43 fmt.Println(Descriptor())44}45func main() {46 fmt.Println("Hello, World!")47 fmt.Println(Descriptor())48}49func main() {50 fmt.Println("Hello, World!")51 fmt.Println(Descriptor())52}53func main() {54 fmt.Println("Hello, World!")55 fmt.Println(Descriptor())56}

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(first.Descriptor())4 fmt.Println(second.Descriptor())5 fmt.Println(third.Descriptor())6}7import (8func main() {9 fmt.Println(second.Descriptor())10}11import (12func main() {13 fmt.Println(third.Descriptor())14}15import (16func main() {17 fmt.Println(first.Descriptor())18}19import (20func main() {21 fmt.Println(first.Descriptor())22}23import (24func main() {25 fmt.Println(second.Descriptor())26}27import (28func main() {29 fmt.Println(third.Descriptor())30}31import (32func main() {33 fmt.Println(first.Descriptor())34}35import (36func main() {37 fmt.Println(second.Descriptor())38}39import (40func main() {41 fmt.Println(third.Descriptor())

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(descriptor.FileDescriptorProto_descriptor)4}5import (6func main() {7 fmt.Println(descriptor.FileDescriptorProto_descriptor)8}9import (10func main() {11 fmt.Println(descriptor.FileDescriptorProto_descriptor)12}13import (14func main() {15 fmt.Println(descriptor.FileDescriptorProto_descriptor)16}17import (18func main() {19 fmt.Println(descriptor.FileDescriptorProto_descriptor)20}21import (22func main() {23 fmt.Println(descriptor.FileDescriptorProto_descriptor)24}25import (26func main() {27 fmt.Println(descriptor.FileDescriptorProto_descriptor)28}29import (30func main() {31 fmt.Println(descriptor.FileDescriptorProto_descriptor)32}

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4 t := new(T)5 t.Descriptor()6}7import (8type T struct {9}10func (t *T) Descriptor()

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 obj := new(main)4 obj.Descriptor()5}6import (7func (m main) Descriptor() {8 fmt.Println("This is Descriptor method of main class")9}10type main struct {11}

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello, world!")4 a = new(Dog)5 a.Descriptor()6}7import (8type Animal interface {9 Descriptor()10}11type Dog struct {12}13func (d *Dog) Descriptor() {14 fmt.Println("I am a dog")15}16func main() {17 fmt.Println("Hello, world!")18 a = new(Dog)19 a.Descriptor()20}21import (22type Animal interface {23 Descriptor()24}25type Dog struct {26}27func (d *Dog) Descriptor() {28 fmt.Println("I am a dog")29}30type Cat struct {31}32func (c *Cat) Descriptor() {33 fmt.Println("I am a cat")34}35func main() {36 fmt.Println("Hello, world!")37 a = new(Dog)38 a.Descriptor()39 a = new(Cat)40 a.Descriptor()41}42import (43type Animal interface {44 Descriptor()45}46type Dog struct {47}48func (d *Dog) Descriptor() {49 fmt.Println("I am a dog")50}51type Cat struct {52}53func (c *Cat) Descriptor() {54 fmt.Println("I am a cat")55}56func main() {57 fmt.Println("Hello, world!")58 a = new(Dog)59 a.Descriptor()60 a = new(Cat)61 a.Descriptor()62}63import (64type Animal interface {65 Descriptor()66}67type Dog struct {68}69func (d *Dog) Descriptor() {70 fmt.Println("I am a dog")71}72type Cat struct {73}74func (c *Cat) Descriptor() {75 fmt.Println("I am a cat")76}77func main() {78 fmt.Println("Hello, world!")79 a = new(Dog)80 a.Descriptor()

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 myCar = Car{"Ferrari", 250, 2000}4 fmt.Println(myCar.Descriptor())5}6import (7type Car struct {8}9func (c Car) Descriptor() string {10 return fmt.Sprintf("%d %s %d", c.Year, c.Make, c.Model)11}12func main() {13 myCar = Car{"Ferrari", 250, 2000}14 fmt.Println(myCar.Descriptor())15}16In the above code, we are creating a struct Car with three fields Make, Model and Year. We are then creating a method Descriptor() which returns a string. The method Descriptor() is called on the variable myCar of type Car. The method Descriptor() returns a string which is then printed by the fmt.Println() function. The output is:17The Descriptor() method is a method of the Car struct. We can also create a method of the main class. In the next example, we will create a method Descriptor() of the main class. We will then call the Descriptor() method on the variable myCar of type Car. The Descriptor() method returns a string which is then printed by the fmt.Println() function. The output is:18In the above code, we are creating a struct Car with three fields Make, Model and Year. We are then creating a method Descriptor() which returns a string. The method Descriptor() is called on the variable myCar of type Car. The method Descriptor() returns a string which is then printed by the fmt.Println() function. The output is:19The Descriptor() method is a method of the Car struct. We can also create a method of the main class. In the next example, we will create a method Descriptor() of the main class. We will then call the Descriptor() method on the variable myCar of type Car. The Descriptor() method returns a string which is then printed by the fmt.Println() function. The output is:

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 a = &Person{"Bob", 20}4 fmt.Println(a.Descriptor())5}6import "fmt"7func main() {8 a = &Person{"Bob", 20}9 fmt.Println(a.Descriptor())10}11import "fmt"12func main() {13 a = &Person{"Bob", 20}14 fmt.Println(a.Descriptor())15}16import "fmt"17func main() {18 a = &Person{"Bob", 20}19 fmt.Println(a.Descriptor())20}21import "fmt"22func main() {23 a = &Person{"Bob", 20}24 fmt.Println(a.Descriptor())25}26import "fmt"27func main() {28 a = &Person{"Bob", 20}29 fmt.Println(a.Descriptor())30}31import "fmt"32func main() {33 a = &Person{"Bob", 20}34 fmt.Println(a.Descriptor())35}36import "fmt"37func main() {38 a = &Person{"Bob", 20}39 fmt.Println(a.Descriptor())40}

Full Screen

Full Screen

Descriptor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("This is main class")4 class1.Descriptor()5}6import "fmt"7func Descriptor() {8 fmt.Println("This is class1")9}10import "fmt"11func Descriptor() {12 fmt.Println("This is class2")13}14import "fmt"15func Descriptor() {16 fmt.Println("This is class3")17}18import "fmt"19func Descriptor() {20 fmt.Println("This is class4")21}22import "fmt"23func Descriptor() {24 fmt.Println("This is class5")25}26import "fmt"27func Descriptor() {28 fmt.Println("This is class6")29}30import "fmt"31func Descriptor() {32 fmt.Println("This is class7")33}34import "fmt"35func Descriptor() {36 fmt.Println("This is class8")37}38import "fmt"39func Descriptor() {40 fmt.Println("This is class9")41}42import "fmt"43func Descriptor() {

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful