s_expressions-encodings: replace assert-in-loop by asserting a slice comparison