// KEKS -- Go KEKS codec implementation
// Copyright (C) 2024-2025 Anton Rudenko <rudenko.ad@phystech.edu>
//                         Sergey Matveev <stargrave@stargrave.org>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program.  If not, see <http://www.gnu.org/licenses/>.

package keks

import (
	"io"
	"testing"
)

func TestUnknownTag(t *testing.T) {
	_, err := NewDecoderFromBytes(append([]byte{0x05}, Junk...), nil).Decode()
	if err != ErrUnknownType {
		t.Fatal(err)
	}
}

func TestEmptyData(t *testing.T) {
	binstring := []byte{}
	_, err := NewDecoderFromBytes(binstring, nil).Decode()
	if err != io.ErrUnexpectedEOF {
		t.Fatal(err)
	}
}

func TestLonelyEOC(t *testing.T) {
	_, err := NewDecoderFromBytes(append([]byte{0x00}, Junk...), nil).Decode()
	if err != ErrEOCUnexpected {
		t.Fatal(err)
	}
}
