2021-04-02 15:36:43 -04:00
|
|
|
package document
|
2021-04-01 12:02:17 -04:00
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestNewDocument(t *testing.T) {
|
2021-04-02 14:52:44 -04:00
|
|
|
d := NewDocument()
|
2021-04-01 12:02:17 -04:00
|
|
|
|
|
|
|
if d == nil {
|
2021-04-02 14:52:44 -04:00
|
|
|
t.Errorf("Failed to create Document")
|
2021-04-01 12:02:17 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAppendRow(t *testing.T) {
|
2021-04-02 14:52:44 -04:00
|
|
|
d := NewDocument()
|
|
|
|
d.AppendRow("Test Row")
|
2021-04-01 12:02:17 -04:00
|
|
|
|
|
|
|
got := len(d.rows)
|
|
|
|
want := 1
|
|
|
|
|
|
|
|
if got != want {
|
2021-04-02 14:52:44 -04:00
|
|
|
t.Errorf("Failed to add a row to the Document")
|
2021-04-01 12:02:17 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestRowCount(t *testing.T) {
|
2021-04-02 14:52:44 -04:00
|
|
|
d := NewDocument()
|
|
|
|
d.AppendRow("Test Row")
|
2021-04-01 12:02:17 -04:00
|
|
|
|
2021-04-02 14:52:44 -04:00
|
|
|
got := d.RowCount()
|
2021-04-01 12:02:17 -04:00
|
|
|
want := 1
|
|
|
|
|
|
|
|
if got != want {
|
|
|
|
t.Errorf("Expected %d rows, got %d rows", want, got)
|
|
|
|
}
|
2021-04-01 16:17:13 -04:00
|
|
|
}
|