test for overflows in 'weighted sum'

Signed-off-by: Sergei Ianovich <ynvich@gmail.com>