From 25bd86bfd5d5239a95b59d48591e89a6484d8204 Mon Sep 17 00:00:00 2001 From: Rootul Patel Date: Fri, 8 Dec 2023 15:46:30 -0500 Subject: [PATCH] test: versioned constants --- pkg/appconsts/versioned_consts_test.go | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 pkg/appconsts/versioned_consts_test.go diff --git a/pkg/appconsts/versioned_consts_test.go b/pkg/appconsts/versioned_consts_test.go new file mode 100644 index 0000000000..6a1e5f5592 --- /dev/null +++ b/pkg/appconsts/versioned_consts_test.go @@ -0,0 +1,48 @@ +package appconsts_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/celestiaorg/celestia-app/pkg/appconsts" + v1 "github.com/celestiaorg/celestia-app/pkg/appconsts/v1" + v2 "github.com/celestiaorg/celestia-app/pkg/appconsts/v2" +) + +func TestSubtreeRootThreshold(t *testing.T) { + type testCase struct { + version uint64 + want int + } + testCases := []testCase{ + {version: v1.Version, want: v1.SubtreeRootThreshold}, + {version: v2.Version, want: v2.SubtreeRootThreshold}, + } + for _, tc := range testCases { + name := fmt.Sprintf("version %v", tc.version) + t.Run(name, func(t *testing.T) { + got := appconsts.SubtreeRootThreshold(tc.version) + assert.Equal(t, tc.want, got) + }) + } +} + +func TestSquareSizeUpperBound(t *testing.T) { + type testCase struct { + version uint64 + want int + } + testCases := []testCase{ + {version: v1.Version, want: v1.SquareSizeUpperBound}, + {version: v2.Version, want: v2.SquareSizeUpperBound}, + } + for _, tc := range testCases { + name := fmt.Sprintf("version %v", tc.version) + t.Run(name, func(t *testing.T) { + got := appconsts.SquareSizeUpperBound(tc.version) + assert.Equal(t, tc.want, got) + }) + } +}