logd: fix bug in FlushTo when requesting exact sequence number

SimpleLogBuffer::FlushTo() attempts to find the iterator matching a
given sequence number, but the logic is wrong and will always skip one
element forward.  This change fixes this and adds a test for the
situation.

This likely contributed to some test instability in the past, but was
identified because subsequent changes that track the start value
closer exacerbated this issue.

Test: existing and new unit tests
Change-Id: Iba2e654e94234693dba20d4747a60bc79d195673
2 files changed