30 lines
889 B
Go
30 lines
889 B
Go
package intelligence
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"materialanalyzer/internal/model"
|
|
)
|
|
|
|
func TestBuildFingerprint(t *testing.T) {
|
|
asset := model.MaterialAsset{
|
|
SKU: "sku-1",
|
|
Visual: model.VisualFeatures{
|
|
Brightness: 0.5, Contrast: 0.1, Saturation: 0.2,
|
|
DominantLAB: model.LAB{L: 50, A: 1, B: 2},
|
|
},
|
|
Texture: model.TextureFeatures{Entropy: 4, TextureFrequency: 0.3, EdgeDensity: 0.1, PrimaryOrientationDeg: 90},
|
|
Canonical: model.CanonicalStatistics{ColorVariance: 0.02, TextureVariance: 0.03},
|
|
Semantic: model.SemanticFeatures{
|
|
MaterialType: "wood", ColorFamily: "Brown", SurfaceFinish: "Matte", GlossLevel: "Low", Variation: "Medium",
|
|
},
|
|
}
|
|
fp := buildFingerprint(asset)
|
|
if fp.SKU != "sku-1" || fp.MaterialType != "wood" || fp.TextureEntropy != 0.5 {
|
|
t.Fatalf("fingerprint = %+v", fp)
|
|
}
|
|
if fp.ReadableSignature == "" {
|
|
t.Fatal("missing readable signature")
|
|
}
|
|
}
|