Unit Test of main helper function, fixes

See if building primitives runs without crashing.

Sanity check on one of the primitive types.

Also fix subtype and equality logic for FunctionTypeValue and TupleTypeValue.