Swig _sr functions and write tests.