mirror of https://bitbucket.org/ausocean/av.git
stream/mts/meta: updating function comments and test function names according to Extract->Get and ExtractAll->GetAll change
This commit is contained in:
parent
f9d8accdae
commit
e796a5a3b7
|
@ -165,7 +165,7 @@ func (m *Data) Encode() []byte {
|
||||||
return m.enc
|
return m.enc
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFrom extracts a value from a metadata string d, for the given key. If the
|
// ReadFrom gets a value from a metadata string d, for the given key. If the
|
||||||
// key is not present in the metadata string, an error is returned. If the
|
// key is not present in the metadata string, an error is returned. If the
|
||||||
// metadata header is not present in the string, an error is returned.
|
// metadata header is not present in the string, an error is returned.
|
||||||
func Get(key string, d []byte) (string, error) {
|
func Get(key string, d []byte) (string, error) {
|
||||||
|
@ -184,7 +184,7 @@ func Get(key string, d []byte) (string, error) {
|
||||||
return "", errKeyAbsent
|
return "", errKeyAbsent
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExtractAll extracts all metadata entries from given data. An Error is returned
|
// GetAll gets all metadata entries from given data. An Error is returned
|
||||||
// if the metadata does not have a valid header, or if the meta format is unexpected.
|
// if the metadata does not have a valid header, or if the meta format is unexpected.
|
||||||
func GetAll(d []byte) ([][2]string, error) {
|
func GetAll(d []byte) ([][2]string, error) {
|
||||||
err := checkHeader(d)
|
err := checkHeader(d)
|
||||||
|
|
|
@ -138,7 +138,7 @@ func TestEncode(t *testing.T) {
|
||||||
|
|
||||||
// TestReadFrom checks that we can correctly obtain a value for a partiular key
|
// TestReadFrom checks that we can correctly obtain a value for a partiular key
|
||||||
// from a string of metadata using the ReadFrom func.
|
// from a string of metadata using the ReadFrom func.
|
||||||
func TestReadFrom(t *testing.T) {
|
func TestGetFrom(t *testing.T) {
|
||||||
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
|
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
@ -166,9 +166,9 @@ func TestReadFrom(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestExtractAll checks that meta.ExtractAll can correctly extract all metadata
|
// TestGetAll checks that meta.GetAll can correctly get all metadata
|
||||||
// from descriptor data.
|
// from descriptor data.
|
||||||
func TestExtractAll(t *testing.T) {
|
func TestGetAll(t *testing.T) {
|
||||||
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
|
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
|
||||||
want := [][2]string{
|
want := [][2]string{
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue