check the last pooling in padding and add padded max pooling test

(Adapted from commit by Jeff.)