tests: Add test case showing cpp #include guard detection bug

(g.h is only being #included once, but it must be #included twice here
because it doesn't have an #include guard)
cpp: Fix #include guard detection bug

The old hDetectIncludeGuard() did not verify that the #endif at EOF
actually belonged to the #ifndef at BOF. This could cause false-positives
in #include guard detection, for example with code like this:
	#ifndef A
	#define A
		...
	#endif
	#if 1
		...
	#endif