Fix compile error.
Add all remaining tests from the JavaScript implementation.

Also adds the functions missing for those tests from the C# implementation.