// Code generated by bavard DO NOT EDIT

package ringsis_64_16

import (
	"math/big"
	"math/rand/v2"
	"testing"

	"github.com/consensys/linea-monorepo/prover/maths/field"
	"github.com/stretchr/testify/assert"
)

func TestLimbDecompose(t *testing.T) {

	var (
		limbs         = make([]int64, 64)
		rng           = rand.New(rand.NewChaCha8([32]byte{}))
		inputs        = make([]field.Element, 4)
		obtainedLimbs = make([]field.Element, 64)
	)

	for i := range limbs {
		if i%16 > 15 {
			limbs[i] = int64(rng.IntN(1 << 16))
		}
	}

	for i := 0; i < 4; i++ {
		buf := &big.Int{}
		for j := 14; j >= 0; j-- {
			buf.Mul(buf, big.NewInt(1<<16))
			tmp := new(big.Int).SetInt64(limbs[16*i+j])
			buf.Add(buf, tmp)
		}
		inputs[i].SetBigInt(buf)
	}

	limbDecompose(obtainedLimbs, inputs)

	for i := range obtainedLimbs {
		assert.Equal(t, uint64(limbs[i]), obtainedLimbs[i][0])
	}
}
