diff --git a/fn.go b/fn.go new file mode 100644 index 0000000..514a4dd --- /dev/null +++ b/fn.go @@ -0,0 +1,173 @@ +package trit + +import "reflect" + +// Logic is a special data type from which to determine the state of trit. +type Logic interface { + bool | int | int8 | int16 | int32 | int64 | Trit +} + +// The logicToTrit function converts any logic type to Trit object. +func logicToTrit[T Logic](v T) Trit { + switch any(v).(type) { + case bool: + if any(v).(bool) { + return True + } + return False + case int, int8, int16, int32, int64: + switch reflect.TypeOf(v).Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + intValue := reflect.ValueOf(v).Int() + if intValue > 0 { + return True + } else if intValue < 0 { + return False + } + + return Nil + } + case Trit: + return any(v).(Trit) + } + + // The event will never fire because the function cannot work with + // types other than Logic. Therefore, this block cannot be tested. + return Nil +} + +// Default sets the default value for the trit-object +// if this one has a Nil state. +// +// Example usage: +// +// t := trit.Nil +// trit.Default(&t, trit.True) +// fmt.Println(t.String()) // Output: True +func Default[T Logic](t *Trit, v T) Trit { + // If the trit is not Nil, return the trit. + if t.Val() != Nil { + return *t + } + + trit := logicToTrit(v) + *t = trit + return *t +} + +// Not performs a logical NOT operation on a Trit-Like value and +// returns the result as Trit. +// +// See Trit.Not() for more information. +func Not[T Logic](t T) Trit { + trit := logicToTrit(t) + return trit.Not() +} + +// Ma performs a logical MA (Modus Ponens Absorption) operation +// on a Trit-Like values and returns the result as Trit. +// +// See Trit.Ma() for more information. +func Ma[T Logic](t T) Trit { + trit := logicToTrit(t) + return trit.Ma() +} + +// La performs a logical LA (Law of Absorption) operation on a Trit-Like +// value and returns the result as Trit. +// +// See Trit.La() for more information. +func La[T Logic](t T) Trit { + trit := logicToTrit(t) + return trit.La() +} + +// Ia performs a logical IA (Idempotent Absorption) operation on a Trit-Like +// value and returns the result as Trit. +// +// See Trit.Ia() for more information. +func Ia[T Logic](t T) Trit { + trit := logicToTrit(t) + return trit.Ia() +} + +// And performs a logical AND operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.And() for more information. +func And[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.And(tb) +} + +// Or performs a logical OR operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.Or() for more information. +func Or[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.Or(tb) +} + +// Xor performs a logical XOR operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.Xor() for more information. +func Xor[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.Xor(tb) +} + +// Nand performs a logical NAND operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.Nand() for more information. +func Nand[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.Nand(tb) +} + +// Nor performs a logical NOR operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.Nor() for more information. +func Nor[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.Nor(tb) +} + +// Nxor performs a logical NXOR operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.Nxor() for more information. +func Nxor[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.Nxor(tb) +} + +// Min performs a logical MIN operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.Min() for more information. +func Min[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.Min(tb) +} + +// Max performs a logical MAX operation between two Trit-Like values +// and returns the result as Trit. +// +// See Trit.Max() for more information. +func Max[T, U Logic](a T, b U) Trit { + ta := logicToTrit(a) + tb := logicToTrit(b) + return ta.Max(tb) +} diff --git a/fn_test.go b/fn_test.go new file mode 100644 index 0000000..5a1ffe9 --- /dev/null +++ b/fn_test.go @@ -0,0 +1,474 @@ +package trit + +import ( + "testing" +) + +// TestLogicToTrit tests the logicToTrit function. +func TestLogicToTrit(t *testing.T) { + // Numbers. + testsInt := []struct { + name string + in int + out Trit + }{ + {"1 should return True", 1, True}, + {"-1 should return False", -1, False}, + {"0 should return Nil", 0, Nil}, + {"-77 should return False", -77, False}, + {"1000000 should return True", 1000000, True}, + } + + for _, test := range testsInt { + t.Run(test.name, func(t *testing.T) { + result := logicToTrit(test.in) + if result != test.out { + t.Errorf("logicToTrit did not return %v for %v", + test.out, test.in) + } + }) + } + + // Bool. + testsBool := []struct { + name string + in bool + out Trit + }{ + {"trut should return True", true, True}, + {"false should return False", false, False}, + } + + for _, test := range testsBool { + t.Run(test.name, func(t *testing.T) { + result := logicToTrit(test.in) + if result != test.out { + t.Errorf("logicToTrit did not return %v for %v", + test.out, test.in) + } + }) + } + + // Trit. + testsTrit := []struct { + name string + in Trit + out Trit + }{ + {"True should return True", True, True}, + {"False should return False", False, False}, + {"Nil should return False", Nil, Nil}, + } + + for _, test := range testsTrit { + t.Run(test.name, func(t *testing.T) { + result := logicToTrit(test.in) + if result != test.out { + t.Errorf("logicToTrit did not return %v for %v", + test.out, test.in) + } + }) + } +} + +// TestDefault tests the Default method. +func TestDefault(t *testing.T) { + t.Run("Default with bool value", func(t *testing.T) { + t1 := Nil + Default(&t1, true) + if t1 != True { + t.Errorf("Default did not update Nil to True") + } + + t2 := Nil + Default(&t2, false) + if t2 != False { + t.Errorf("Default did not update Nil to False") + } + }) + + t.Run("Default with numeric value", func(t *testing.T) { + t1 := Nil + Default(&t1, int32(1)) // for example int32 + if t1 != True { + t.Errorf("Default did not update Nil to True") + } + + t2 := Nil + Default(&t2, int64(-1)) // for example int64 + if t2 != False { + t.Errorf("Default did not update Nil to False") + } + }) + + t.Run("Default with Trit value", func(t *testing.T) { + t1 := Nil + Default(&t1, True) + if t1 != True { + t.Errorf("Default did not update Nil to True") + } + + t2 := Nil + Default(&t2, False) + if t2 != False { + t.Errorf("Default did not update Nil to False") + } + }) + + t.Run("Should not update non-Nil Trit", func(t *testing.T) { + t1 := True + Default(&t1, false) + if t1 != True { + t.Errorf("Default updated non-Nil Trit") + } + }) +} + +// TestNot tests the Not function. +func TestNot(t *testing.T) { + tests := []struct { + name string + in Trit + out Trit + }{ + {"Not should return True for False", False, True}, + {"Not should return Nil for Nil", Nil, Nil}, + {"Not should return False for True", True, False}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Not(test.in) + if result != test.out { + t.Errorf("Not did not return %v for %v", test.out, test.in) + } + }) + } +} + +// TestMa tests the Ma function. +func TestMa(t *testing.T) { + tests := []struct { + name string + in Trit + out Trit + }{ + {"Ma should return False for False", False, False}, + {"Ma should return True for Nil", Nil, True}, + {"Ma should return True for True", True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Ma(test.in) + if result != test.out { + t.Errorf("Ma did not return %v for %v", test.out, test.in) + } + }) + } +} + +// TestLa tests the La function. +func TestLa(t *testing.T) { + tests := []struct { + name string + in Trit + out Trit + }{ + {"La should return False for False", False, False}, + {"La should return False for Nil", Nil, False}, + {"La should return True for True", True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := La(test.in) + if result != test.out { + t.Errorf("La did not return %v for %v", test.out, test.in) + } + }) + } +} + +// TestIa tests the Ia function. +func TestIa(t *testing.T) { + tests := []struct { + name string + in Trit + out Trit + }{ + {"Ia should return False for False", False, False}, + {"Ia should return True for Nil", Nil, True}, + {"Ia should return False for True", True, False}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Ia(test.in) + if result != test.out { + t.Errorf("Ia did not return %v for %v", test.out, test.in) + } + }) + } +} + +// TestAnd tests the And function. +func TestAnd(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"And should return False for (False, False)", False, False, False}, + {"And should return False for (False, Nil)", False, Nil, False}, + {"And should return False for (False, True)", False, True, False}, + {"And should return False for (Nil, False)", Nil, False, False}, + {"And should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"And should return Nil for (Nil, True)", Nil, True, Nil}, + {"And should return False for (True, False)", True, False, False}, + {"And should return Nil for (True, Nil)", True, Nil, Nil}, + {"And should return True for (True, True)", True, True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := And(test.a, test.b) + if result != test.out { + t.Errorf("And did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestOr tests the Or function. +func TestOr(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Or should return False for (False, False)", False, False, False}, + {"Or should return Nil for (False, Nil)", False, Nil, Nil}, + {"Or should return True for (False, True)", False, True, True}, + {"Or should return Nil for (Nil, False)", Nil, False, Nil}, + {"Or should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"Or should return True for (Nil, True)", Nil, True, True}, + {"Or should return True for (True, False)", True, False, True}, + {"Or should return True for (True, Nil)", True, Nil, True}, + {"Or should return True for (True, True)", True, True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Or(test.a, test.b) + if result != test.out { + t.Errorf("Or did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestXor tests the Xor function. +func TestXor(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Xor should return False for (False, False)", False, False, False}, + {"Xor should return Nil for (False, Nil)", False, Nil, Nil}, + {"Xor should return True for (False, True)", False, True, True}, + {"Xor should return Nil for (Nil, False)", Nil, False, Nil}, + {"Xor should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"Xor should return Nil for (Nil, True)", Nil, True, Nil}, + {"Xor should return True for (True, False)", True, False, True}, + {"Xor should return Nil for (True, Nil)", True, Nil, Nil}, + {"Xor should return False for (True, True)", True, True, False}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Xor(test.a, test.b) + if result != test.out { + t.Errorf("Xor did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestNand tests the Nand function. +func TestNand(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Nand should return True for (False, False)", False, False, True}, + {"Nand should return True for (False, Nil)", False, Nil, True}, + {"Nand should return True for (False, True)", False, True, True}, + {"Nand should return True for (Nil, False)", Nil, False, True}, + {"Nand should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"Nand should return Nil for (Nil, True)", Nil, True, Nil}, + {"Nand should return True for (True, False)", True, False, True}, + {"Nand should return Nil for (True, Nil)", True, Nil, Nil}, + {"Nand should return False for (True, True)", True, True, False}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Nand(test.a, test.b) + if result != test.out { + t.Errorf("Nand did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestNor tests the Nor function. +func TestNor(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Nor should return True for (False, False)", False, False, True}, + {"Nor should return Nil for (False, Nil)", False, Nil, Nil}, + {"Nor should return False for (False, True)", False, True, False}, + {"Nor should return Nil for (Nil, False)", Nil, False, Nil}, + {"Nor should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"Nor should return False for (Nil, True)", Nil, True, False}, + {"Nor should return False for (True, False)", True, False, False}, + {"Nor should return False for (True, Nil)", True, Nil, False}, + {"Nor should return False for (True, True)", True, True, False}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Nor(test.a, test.b) + if result != test.out { + t.Errorf("Nor did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestNxor tests the Nxor function. +func TestNxor(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Nxor should return True for (False, False)", False, False, True}, + {"Nxor should return Nil for (False, Nil)", False, Nil, Nil}, + {"Nxor should return False for (False, True)", False, True, False}, + {"Nxor should return Nil for (Nil, False)", Nil, False, Nil}, + {"Nxor should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"Nxor should return Nil for (Nil, True)", Nil, True, Nil}, + {"Nxor should return False for (True, False)", True, False, False}, + {"Nxor should return Nil for (True, Nil)", True, Nil, Nil}, + {"Nxor should return True for (True, True)", True, True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Nxor(test.a, test.b) + if result != test.out { + t.Errorf("Nxor did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestMin tests the Min function. +func TestMin(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Min should return False for (False, False)", False, False, False}, + {"Min should return False for (False, Nil)", False, Nil, False}, + {"Min should return False for (False, True)", False, True, False}, + {"Min should return False for (Nil, False)", Nil, False, False}, + {"Min should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"Min should return Nil for (Nil, True)", Nil, True, Nil}, + {"Min should return False for (True, False)", True, False, False}, + {"Min should return Nil for (True, Nil)", True, Nil, Nil}, + {"Min should return True for (True, True)", True, True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Min(test.a, test.b) + if result != test.out { + t.Errorf("Min did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestMax tests the Max function. +func TestMax(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Max should return False for (False, False)", False, False, False}, + {"Max should return Nil for (False, Nil)", False, Nil, Nil}, + {"Max should return True for (False, True)", False, True, True}, + {"Max should return Nil for (Nil, False)", Nil, False, Nil}, + {"Max should return Nil for (Nil, Nil)", Nil, Nil, Nil}, + {"Max should return True for (Nil, True)", Nil, True, True}, + {"Max should return True for (True, False)", True, False, True}, + {"Max should return True for (True, Nil)", True, Nil, True}, + {"Max should return True for (True, True)", True, True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := Max(test.a, test.b) + if result != test.out { + t.Errorf("Max did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} + +// TestImp tests the Imp function. +func TestImp(t *testing.T) { + tests := []struct { + name string + a Trit + b Trit + out Trit + }{ + {"Imp should return True for (False, False)", False, False, True}, + {"Imp should return True for (False, Nil)", False, Nil, True}, + {"Imp should return True for (False, True)", False, True, True}, + {"Imp should return Nil for (Nil, False)", Nil, False, Nil}, + {"Imp should return True for (Nil, Nil)", Nil, Nil, True}, + {"Imp should return True for (Nil, True)", Nil, True, True}, + {"Imp should return False for (True, False)", True, False, False}, + {"Imp should return Nil for (True, Nil)", True, Nil, Nil}, + {"Imp should return True for (True, True)", True, True, True}, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + result := test.a.Imp(test.b) + if result != test.out { + t.Errorf("Imp did not return %v for (%v, %v)", test.out, test.a, test.b) + } + }) + } +} diff --git a/trit.go b/trit.go index 6797143..64eb99b 100644 --- a/trit.go +++ b/trit.go @@ -76,8 +76,6 @@ // T | T | T T | T | T T | T | T package trit -import "reflect" - // Trit represents a trinary digit, which can take on three distinct // states: False, Nil, or True. This type is a fundamental unit of // trinary or ternary logic systems, including trinary computers and @@ -105,67 +103,15 @@ const ( True Trit = 1 ) -// Logic is a special data type from which to determine the state of trit. -type Logic interface { - bool | int | int8 | int16 | int32 | int64 | Trit -} - -// The logicToTrit function converts any logic type to Trit object. -func logicToTrit[T Logic](v T) Trit { - switch any(v).(type) { - case bool: - if any(v).(bool) { - return True - } - return False - case int, int8, int16, int32, int64: - switch reflect.TypeOf(v).Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, - reflect.Int32, reflect.Int64: - intValue := reflect.ValueOf(v).Int() - if intValue > 0 { - return True - } else if intValue < 0 { - return False - } - - return Nil - } - case Trit: - return any(v).(Trit) - } - - return Nil -} - -// Default sets the default value for the trit-object -// if this one has a Nil state. -// -// Example usage: -// -// t := trit.Nil -// trit.Default(&t, trit.True) -// fmt.Println(t.String()) // Output: True -func Default[T Logic](t *Trit, v T) Trit { - // If the trit is not Nil, return the trit. - if t.Val() != Nil { - return *t - } - - trit := logicToTrit(v) - *t = trit - return *t -} - -// Def is a method that checks if the value of the Trit is Nil. +// Default is a method that checks if the value of the Trit is Nil. // If it is, it sets the Trit to the given Trit argument. // // Example usage: // // t := trit.Nil -// t.Def(trit.True) +// t.Default(trit.True) // fmt.Println(t.String()) // Output: True -func (t *Trit) Def(trit Trit) Trit { +func (t *Trit) Default(trit Trit) Trit { if t.Val() == Nil { *t = trit } diff --git a/trit_test.go b/trit_test.go index 3e2bbee..1ec623c 100644 --- a/trit_test.go +++ b/trit_test.go @@ -2,64 +2,11 @@ package trit import "testing" -// TestDefault tests the Default method. -func TestDefault(t *testing.T) { - t.Run("Default with bool value", func(t *testing.T) { - t1 := Nil - Default(&t1, true) - if t1 != True { - t.Errorf("Default did not update Nil to True") - } - - t2 := Nil - Default(&t2, false) - if t2 != False { - t.Errorf("Default did not update Nil to False") - } - }) - - t.Run("Default with numeric value", func(t *testing.T) { - t1 := Nil - Default(&t1, int32(1)) // for example int32 - if t1 != True { - t.Errorf("Default did not update Nil to True") - } - - t2 := Nil - Default(&t2, int64(-1)) // for example int64 - if t2 != False { - t.Errorf("Default did not update Nil to False") - } - }) - - t.Run("Default with Trit value", func(t *testing.T) { - t1 := Nil - Default(&t1, True) - if t1 != True { - t.Errorf("Default did not update Nil to True") - } - - t2 := Nil - Default(&t2, False) - if t2 != False { - t.Errorf("Default did not update Nil to False") - } - }) - - t.Run("Should not update non-Nil Trit", func(t *testing.T) { - t1 := True - Default(&t1, false) - if t1 != True { - t.Errorf("Default updated non-Nil Trit") - } - }) -} - -// TestDef tests the Def method. -func TestDef(t *testing.T) { +// TestMethodDefault tests the Default method. +func TestMethodDefault(t *testing.T) { t.Run("Def should update Nil to True", func(t *testing.T) { t1 := Nil - result := t1.Def(True) + result := t1.Default(True) if result != True { t.Errorf("Def did not update Nil to True") } @@ -67,7 +14,7 @@ func TestDef(t *testing.T) { t.Run("Def should update Nil to False", func(t *testing.T) { t1 := Nil - result := t1.Def(False) + result := t1.Default(False) if result != False { t.Errorf("Def did not update Nil to False") } @@ -75,7 +22,7 @@ func TestDef(t *testing.T) { t.Run("Def should not update non-Nil Trit", func(t *testing.T) { t1 := True - result := t1.Def(False) + result := t1.Default(False) if result != True { t.Errorf("Def updated non-Nil Trit") } @@ -361,8 +308,8 @@ func TestString(t *testing.T) { }) } -// TestNot tests the Not method. -func TestNot(t *testing.T) { +// TestMethodNot tests the Not method. +func TestMethodNot(t *testing.T) { tests := []struct { name string in Trit @@ -383,8 +330,8 @@ func TestNot(t *testing.T) { } } -// TestMa tests the Ma method. -func TestMa(t *testing.T) { +// TestMethodMa tests the Ma method. +func TestMethodMa(t *testing.T) { tests := []struct { name string in Trit @@ -405,8 +352,8 @@ func TestMa(t *testing.T) { } } -// TestLa tests the La method. -func TestLa(t *testing.T) { +// TestMethodLa tests the La method. +func TestMethodLa(t *testing.T) { tests := []struct { name string in Trit @@ -427,8 +374,8 @@ func TestLa(t *testing.T) { } } -// TestIa tests the Ia method. -func TestIa(t *testing.T) { +// TestMethodIa tests the Ia method. +func TestMethodIa(t *testing.T) { tests := []struct { name string in Trit @@ -449,8 +396,8 @@ func TestIa(t *testing.T) { } } -// TestAnd tests the And method. -func TestAnd(t *testing.T) { +// TestMethodAnd tests the And method. +func TestMethodAnd(t *testing.T) { tests := []struct { name string a Trit @@ -478,8 +425,8 @@ func TestAnd(t *testing.T) { } } -// TestOr tests the Or method. -func TestOr(t *testing.T) { +// TestMethodOr tests the Or method. +func TestMethodOr(t *testing.T) { tests := []struct { name string a Trit @@ -507,8 +454,8 @@ func TestOr(t *testing.T) { } } -// TestXor tests the Xor method. -func TestXor(t *testing.T) { +// TestMethodXor tests the Xor method. +func TestMethodXor(t *testing.T) { tests := []struct { name string a Trit @@ -536,8 +483,8 @@ func TestXor(t *testing.T) { } } -// TestNand tests the Nand method. -func TestNand(t *testing.T) { +// TestMethodNand tests the Nand method. +func TestMethodNand(t *testing.T) { tests := []struct { name string a Trit @@ -565,8 +512,8 @@ func TestNand(t *testing.T) { } } -// TestNor tests the Nor method. -func TestNor(t *testing.T) { +// TestMethodNor tests the Nor method. +func TestMethodNor(t *testing.T) { tests := []struct { name string a Trit @@ -594,8 +541,8 @@ func TestNor(t *testing.T) { } } -// TestNxor tests the Nxor method. -func TestNxor(t *testing.T) { +// TestMethodNxor tests the Nxor method. +func TestMethodNxor(t *testing.T) { tests := []struct { name string a Trit @@ -623,8 +570,8 @@ func TestNxor(t *testing.T) { } } -// TestMin tests the Min method. -func TestMin(t *testing.T) { +// TestMethodMin tests the Min method. +func TestMethodMin(t *testing.T) { tests := []struct { name string a Trit @@ -652,8 +599,8 @@ func TestMin(t *testing.T) { } } -// TestMax tests the Max method. -func TestMax(t *testing.T) { +// TestMethodMax tests the Max method. +func TestMethodMax(t *testing.T) { tests := []struct { name string a Trit @@ -681,8 +628,8 @@ func TestMax(t *testing.T) { } } -// TestImp tests the Imp method. -func TestImp(t *testing.T) { +// TestMethodImp tests the Imp method. +func TestMethodImp(t *testing.T) { tests := []struct { name string a Trit