Function read() now returns as '\n' character when it encounters a newline.
Added test cases for read/unread