MCPcopy Index your code
hub / github.com/expr-lang/expr / TestVM_ProfileOperations

Function TestVM_ProfileOperations

vm/vm_test.go:537–561  ·  view source on GitHub ↗

TestVM_ProfileOperations tests the profiling opcodes

(t *testing.T)

Source from the content-addressed store, hash-verified

535
536// TestVM_ProfileOperations tests the profiling opcodes
537func TestVM_ProfileOperations(t *testing.T) {
538 program := &vm.Program{
539 Bytecode: []vm.Opcode{
540 vm.OpProfileStart,
541 vm.OpPush,
542 vm.OpCall,
543 vm.OpProfileEnd,
544 },
545 Arguments: []int{0, 1, 0, 0},
546 Constants: []any{
547 &vm.Span{},
548 func() (any, error) {
549 time.Sleep(time.Millisecond * 10)
550 return nil, nil
551 },
552 },
553 }
554
555 testVM := &vm.VM{}
556 _, err := testVM.Run(program, nil)
557 require.NoError(t, err)
558
559 span := program.Constants[0].(*vm.Span)
560 require.Greater(t, span.Duration, time.Millisecond)
561}
562
563// TestVM_IndexOperations tests the index manipulation opcodes
564func TestVM_IndexOperations(t *testing.T) {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.95
NoErrorFunction · 0.92
GreaterFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…