Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
b803cfd2
Commit
b803cfd2
authored
Mar 14, 2023
by
Andreas Bigger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamic assertions
✨
parent
59c14665
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
11 deletions
+29
-11
channel_config_test.go
op-batcher/batcher/channel_config_test.go
+29
-11
No files found.
op-batcher/batcher/channel_config_test.go
View file @
b803cfd2
package
batcher_test
import
(
"math"
"testing"
"github.com/ethereum-optimism/optimism/op-batcher/batcher"
...
...
@@ -16,8 +17,8 @@ func TestInputThreshold(t *testing.T) {
ApproxComprRatio
float64
}
type
test
struct
{
input
testInput
want
uint64
input
testInput
assertion
func
(
uint64
)
}
// Construct test cases that test the boundary conditions
...
...
@@ -28,7 +29,9 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
1
,
ApproxComprRatio
:
0.4
,
},
want
:
2
,
assertion
:
func
(
output
uint64
)
{
require
.
Equal
(
t
,
uint64
(
2
),
output
)
},
},
{
input
:
testInput
{
...
...
@@ -36,7 +39,9 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
1
,
ApproxComprRatio
:
1
,
},
want
:
1
,
assertion
:
func
(
output
uint64
)
{
require
.
Equal
(
t
,
uint64
(
1
),
output
)
},
},
{
input
:
testInput
{
...
...
@@ -44,7 +49,9 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
1
,
ApproxComprRatio
:
2
,
},
want
:
0
,
assertion
:
func
(
output
uint64
)
{
require
.
Equal
(
t
,
uint64
(
0
),
output
)
},
},
{
input
:
testInput
{
...
...
@@ -52,7 +59,9 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
1
,
ApproxComprRatio
:
0.4
,
},
want
:
250
_000
,
assertion
:
func
(
output
uint64
)
{
require
.
Equal
(
t
,
uint64
(
250
_000
),
output
)
},
},
{
input
:
testInput
{
...
...
@@ -60,7 +69,9 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
100000
,
ApproxComprRatio
:
0.4
,
},
want
:
250
_000
,
assertion
:
func
(
output
uint64
)
{
require
.
Equal
(
t
,
uint64
(
250
_000
),
output
)
},
},
{
input
:
testInput
{
...
...
@@ -68,7 +79,9 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
100000
,
ApproxComprRatio
:
0.4
,
},
want
:
25
_000_000_000
,
assertion
:
func
(
output
uint64
)
{
require
.
Equal
(
t
,
uint64
(
25
_000_000_000
),
output
)
},
},
{
input
:
testInput
{
...
...
@@ -76,7 +89,9 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
1
,
ApproxComprRatio
:
0.000001
,
},
want
:
1
_000_000
,
assertion
:
func
(
output
uint64
)
{
require
.
Equal
(
t
,
uint64
(
1
_000_000
),
output
)
},
},
{
input
:
testInput
{
...
...
@@ -84,7 +99,10 @@ func TestInputThreshold(t *testing.T) {
TargetNumFrames
:
0
,
ApproxComprRatio
:
0
,
},
want
:
0
,
assertion
:
func
(
output
uint64
)
{
// Need to allow for NaN depending on the machine architecture
require
.
True
(
t
,
output
==
uint64
(
0
)
||
output
==
uint64
(
math
.
NaN
()))
},
},
}
...
...
@@ -96,6 +114,6 @@ func TestInputThreshold(t *testing.T) {
ApproxComprRatio
:
tt
.
input
.
ApproxComprRatio
,
}
got
:=
config
.
InputThreshold
()
require
.
Equal
(
t
,
tt
.
want
,
got
)
tt
.
assertion
(
got
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment