This demo contains a few basic quaternion functions, and demonstrates them with four test cases, controlled by number keys 1 to 4:
1: Rotate model by a quaternion
2: Rotate model between two rotations with slerp
3: Rotate model between three rotations with squad
4: Rotate model between three rotations with two slerps, in order to demonstrate the jumpiness that squad avoids.
This code is partially based on an AntTweakBar demo, but that code also agrees well with the book so I could have taken it straight from there.