MCPcopy Index your code
hub / github.com/apache/iotdb-client-go / TestTablet_Sort

Function TestTablet_Sort

client/tablet_test.go:560–630  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

558}
559
560func TestTablet_Sort(t *testing.T) {
561
562 tests := []struct {
563 name string
564 want [][]interface{}
565 wantErr bool
566 }{
567 {
568 name: "item-1",
569 want: [][]interface{}{
570 {int32(3), float64(3.0), int64(3), float32(3.0), "3", true},
571 {int32(4), float64(4.0), int64(4), float32(4.0), "4", true},
572 {int32(1), float64(1.0), int64(1), float32(1.0), "1", true},
573 {int32(2), float64(2.0), int64(2), float32(2.0), "2", true},
574 },
575 wantErr: false,
576 },
577 }
578 for _, tt := range tests {
579 t.Run(tt.name, func(t *testing.T) {
580 tablet, _ := createTablet(4)
581 tablet.SetValueAt(int32(1), 0, 0)
582 tablet.SetValueAt(float64(1.0), 1, 0)
583 tablet.SetValueAt(int64(1), 2, 0)
584 tablet.SetValueAt(float32(1.0), 3, 0)
585 tablet.SetValueAt("1", 4, 0)
586 tablet.SetValueAt(true, 5, 0)
587 tablet.SetTimestamp(3, 0)
588 tablet.RowSize++
589
590 tablet.SetValueAt(int32(2), 0, 1)
591 tablet.SetValueAt(float64(2.0), 1, 1)
592 tablet.SetValueAt(int64(2), 2, 1)
593 tablet.SetValueAt(float32(2.0), 3, 1)
594 tablet.SetValueAt("2", 4, 1)
595 tablet.SetValueAt(true, 5, 1)
596 tablet.SetTimestamp(4, 1)
597 tablet.RowSize++
598
599 tablet.SetValueAt(int32(3), 0, 2)
600 tablet.SetValueAt(float64(3.0), 1, 2)
601 tablet.SetValueAt(int64(3), 2, 2)
602 tablet.SetValueAt(float32(3.0), 3, 2)
603 tablet.SetValueAt("3", 4, 2)
604 tablet.SetValueAt(true, 5, 2)
605 tablet.SetTimestamp(1, 2)
606 tablet.RowSize++
607
608 tablet.SetValueAt(int32(4), 0, 3)
609 tablet.SetValueAt(float64(4.0), 1, 3)
610 tablet.SetValueAt(int64(4), 2, 3)
611 tablet.SetValueAt(float32(4.0), 3, 3)
612 tablet.SetValueAt("4", 4, 3)
613 tablet.SetValueAt(true, 5, 3)
614 tablet.SetTimestamp(2, 3)
615 tablet.RowSize++
616
617 if err := tablet.Sort(); (err != nil) != tt.wantErr {

Callers

nothing calls this directly

Calls 5

SetValueAtMethod · 0.80
SetTimestampMethod · 0.80
SortMethod · 0.80
GetValueAtMethod · 0.80
createTabletFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…