MCPcopy Create free account
hub / github.com/distributedio/titan / TestStringIncrf

Function TestStringIncrf

db/string_test.go:531–564  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

529}
530
531func TestStringIncrf(t *testing.T) {
532 type args struct {
533 delta float64
534 }
535 tests := []struct {
536 name string
537 args args
538 want float64
539 }{
540 {
541 name: "Incr",
542 args: args{
543 delta: float64(0.2),
544 },
545 want: float64(10.3),
546 },
547 }
548 for _, tt := range tests {
549 t.Run(tt.name, func(t *testing.T) {
550 callFunc := func(txn *Transaction) {
551 s, err := GetString(txn, value)
552 assert.NoError(t, err)
553 err = s.Set([]byte("10.1"))
554 assert.NoError(t, err)
555 got, err := s.Incrf(tt.args.delta)
556 assert.NoError(t, err)
557 if got < tt.want-0.000000000000001 {
558 t.Errorf("String.Incrf() = %v, want %v", got, tt.want)
559 }
560 }
561 MockTest(t, callFunc)
562 })
563 }
564}
565
566func TestStringSetBit(t *testing.T) {
567 type args struct {

Callers

nothing calls this directly

Calls 4

GetStringFunction · 0.85
MockTestFunction · 0.85
IncrfMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected