package logic

import (
	"strings"
	"testing"
	"time"
)

const (
	Output = `----------- SCAN SUMMARY -----------
Infected files: 0
Time: 0.981 sec (0 m 0 s)
Start Date: 2026:02:14 09:39:02
End Date:   2026:02:14 09:39:03`
)

func TestRegext(t *testing.T) {
	lines := strings.Split(Output, "\n")
	for _, i := range lines {
		if ReInfectedFile.MatchString(i) {
			f := ReInfectedFile.FindStringSubmatch(i)
			for _, ff := range f {
				t.Log(ff)
			}
		}
	}
}

func TestScanFile(t *testing.T) {
	target := "./hycusmutool"
	start := time.Now()
	have, err := ScanFile(target)
	dua := time.Since(start)

	if have {
		t.Logf("%s is bd", target)
	}

	t.Logf("used time: %dms", dua.Milliseconds())
	if err != nil {
		t.Error(err)
	}
}

func TestParseInt(t *testing.T) {
	i, err := ParseInt("abc")
	if err != nil {
		t.Error(err)
	}
	t.Logf("%d", i)
}
