github.com/bluenviron/mediacommon@v1.9.3/pkg/codecs/g711/decode_test.go (about)

     1  package g711
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestDecodeMuLaw(t *testing.T) {
    10  	require.Equal(t,
    11  		DecodeMulaw([]byte{1, 2, 3, 255, 254, 253}),
    12  		[]byte{
    13  			0x86, 0x84, 0x8a, 0x84, 0x8e, 0x84, 0x00, 0x00,
    14  			0x00, 0x08, 0x00, 0x10,
    15  		},
    16  	)
    17  }
    18  
    19  func TestDecodeALaw(t *testing.T) {
    20  	require.Equal(t,
    21  		DecodeAlaw([]byte{1, 2, 3, 255, 254, 253}),
    22  		[]byte{
    23  			0xeb, 0x80, 0xe8, 0x80, 0xe9, 0x80, 0x03, 0x50,
    24  			0x03, 0x70, 0x03, 0x10,
    25  		},
    26  	)
    27  }