I just joined PlanetMinecraft but I am an expert pretty good at MC commands, you use the /testforblock command like /testforblock (x, y, z) and then minecraft:(in-code block name) such as
/testforblock ~ ~1 ~ minecraft:stone (tests if block one above is stone) furthermore you can use it with a data value at the end to test for a specific data value.