# 11.9 Testing¶

Once you have written the package, embed it in a file, for example, sortpak.spad. testing Be sure to include an )abbrev command at the top of the file:

```
)abbrev package SORTPAK SortPackage
```

Now compile the file (using )compile sortpak.spad).

Expose the constructor. You are then ready to begin testing.

```
)expose SORTPAK
```

Define a list.

```
l := [1,7,4,2,11,-7,3,2]
```

Since the integers are an ordered set, a one-argument operation will do.

```
bubbleSort!(l)
```

Re-sort it using greater than.

```
bubbleSort!(l,(x,y) +-> x > y)
```

Now sort it again using < on integers.

```
bubbleSort!(l, < $Integer)
```

A string is an aggregate of characters so we can sort them as well.

```
bubbleSort! "Mathematical Sciences"
```

Is < defined on booleans?

```
false < true
```

Good! Create a bit string representing ten consecutive boolean values true.

```
u : Bits := new(10,true)
```

Set bits 3 through 5 to false, then display the result.

```
u(3..5) := false; u
```

Now sort these booleans.

```
bubbleSort! u
```

Create an eq-table, a table having integers as keys and strings as values.

```
t : EqTable(Integer,String) := table()
```

Give the table a first entry.

```
t.1 := "robert"
```

And a second.

```
t.2 := "richard"
```

What does the table look like?

```
t
```

Now sort it.

```
bubbleSort! t
```