{"slug": "nice", "title": "Nice", "summary": "The article describes a test created by an AI language model (gpt-5.4-medium) for the author's CMake-based package manager, which uses file globbing to include source files. The test fixture includes two C files with functions returning 49 and 20, and a main file that checks if their sum equals 69, returning 0 for success or 1 for failure. The author notes the humor in the AI's choice of numbers, resulting in a \"nice\" test that verifies proper globbing and linking.", "body_md": "I asked my good friend gpt-5.4-medium\nto write a little test for my CMake destroyer of a package manager. It was one step beyond cut-n-paste, and the machine politely obliged me. Test passed. Story’s over.\nWait, no! We must look at the code produced by the machines, for it is often fraught with the wringing of many hands. And this one confused me; I added globs, so you can do src/*.c\n, for example. The fixture it created had two C files in child directories, and then included them in the target by glob.\nWe do this all the time; write main.c\nsuch that it fails to compile if, say, the build system fails to append an include directory, or to link a library. It did the same thing here; each file had a function that was called in main\n. No glob, no source, linker complains, test fails. Looks good. Except these were the functions:\nint post() {\nreturn 49;\n}\nint pre() {\nreturn 20;\n}\nHmm? 49\n? 20\n? Surely there’s a simpler way. Hell, the functions don’t even need bodies. What the hell is it doing with these numbers? Well, there’s only one other file in the fixture, main.c\n:\nint pre();\nint post();\nint main(int num_args, const char** args) {\nreturn pre() + post() == 69 ? 0 : 1;\n}\nAh. Nice.", "url": "https://wpnews.pro/news/nice", "canonical_source": "https://spader.zone/nice/", "published_at": "2026-03-25 00:00:00+00:00", "updated_at": "2026-05-23 05:38:25.648577+00:00", "lang": "en", "topics": ["large-language-models", "developer-tools", "artificial-intelligence"], "entities": ["gpt-5.4-medium", "CMake"], "alternates": {"html": "https://wpnews.pro/news/nice", "markdown": "https://wpnews.pro/news/nice.md", "text": "https://wpnews.pro/news/nice.txt", "jsonld": "https://wpnews.pro/news/nice.jsonld"}}