Convexity of a function

what is best way to test convexity of a function?

This is not a forum for general mathematics questions (even about convex analysis), but specifically about the usage of CVX and TFOCS. Please consider a more general purpose mathematics forum.