github.com/benz9527/toy-box/algo@v0.0.0-20240221120937-66c0c6bd5abd/test/algo_suit_test.go (about)

     1  package test
     2  
     3  import (
     4  	"github.com/onsi/ginkgo/v2"
     5  	"github.com/onsi/ginkgo/v2/types"
     6  	"github.com/onsi/gomega"
     7  	"testing"
     8  	"time"
     9  )
    10  
    11  func TestSinglyLinkedListSuite(t *testing.T) {
    12  	// FIXME ginkgo unable run parallel specs in the same package
    13  	type testCase struct {
    14  		name string
    15  		suit func()
    16  	}
    17  	testcases := []testCase{
    18  		{
    19  			name: "1",
    20  			suit: func() {
    21  				gomega.RegisterFailHandler(ginkgo.Fail)
    22  				ginkgo.RunSpecs(t, "Singly Linked BasicLinkedList Suite",
    23  					types.SuiteConfig{
    24  						LabelFilter:     "singlyLinkedList",
    25  						ParallelTotal:   1,
    26  						ParallelProcess: 1,
    27  						GracePeriod:     5 * time.Second,
    28  					},
    29  					types.ReporterConfig{
    30  						Verbose: true,
    31  					},
    32  				)
    33  			},
    34  		},
    35  		{
    36  			name: "2",
    37  			suit: func() {
    38  				gomega.RegisterFailHandler(ginkgo.Fail)
    39  				ginkgo.RunSpecs(t, "Concurrent Singly Linked BasicLinkedList Suite",
    40  					types.SuiteConfig{
    41  						LabelFilter:     "ConcurrentSinglyLinkedList Parallel",
    42  						ParallelTotal:   1,
    43  						ParallelProcess: 1,
    44  						GracePeriod:     5 * time.Second,
    45  					},
    46  					types.ReporterConfig{
    47  						Verbose: true,
    48  					},
    49  				)
    50  			},
    51  		},
    52  	}
    53  	for _, tt := range testcases {
    54  		t.Run(tt.name, func(t *testing.T) {
    55  			tt.suit()
    56  		})
    57  	}
    58  }