unioffice/algo/naturalsort_test.go
Todd 65256235c2 spreadsheet: fix for sheet ordering bug
Need to test this more, may be working by chance...

Updates #154
2018-02-05 20:27:50 -06:00

42 lines
938 B
Go

// Copyright 2017 Baliance. All rights reserved.
//
// Use of this source code is governed by the terms of the Affero GNU General
// Public License version 3.0 as published by the Free Software Foundation and
// appearing in the file LICENSE included in the packaging of this file. A
// commercial license can be purchased by contacting sales@baliance.com.
package algo_test
import (
"testing"
"baliance.com/gooxml/algo"
)
func TestSort(t *testing.T) {
tests := []struct {
a, b string
}{
{"rId1", "rId2"},
{"rId1", "rId10"},
{"rId2", "rId10"},
{"rId5", "rId10"},
{"rId5", "rId15"},
{"rId5", "rId51"},
{"rId1a", "rId1b"},
}
for _, tc := range tests {
if !algo.NaturalLess(tc.a, tc.b) {
t.Errorf("bad sort, expected %s < %s", tc.a, tc.b)
} else {
// no need to check if it failed the first time
if algo.NaturalLess(tc.b, tc.a) {
t.Errorf("bad sort, expected %s > %s", tc.b, tc.a)
}
}
}
}