0

I'm just wondering if there's any popular terminology to refer to program output that is going to be compared to some canned golden data in a unit test. I'm trying to inject this terminology into my code and so far I've come up with things like

int goldIdx;
int outIdx;
double goldValue;
double outValue;

so basically gold vs out. Should be good enough to convey the unit test's retrieval of values but its always good to adopt common idioms if they exist. Is anyone familiar with any?

1

1 Answer 1

10

If I understand you correctly, the terms I would expect are "expected output" (for the "golden data" the test uses) and "actual output" (for what the program actually outputs). If the actual output matches the expected output, the test is passed; otherwise, the test is failed.

I've never heard the word "gold" or "golden" used when talking about unit tests, so I would find that word confusing.

3
  • That's a good point, a lot of the unit test frameworks actually use that terminology of expected vs actual. I wonder where this golden data notion arose from. Maybe its from holding a record of actual data from a bunch of data points at a known working and correct application implementation that we get a snapshot of the output and call that output data golden. I've only seen it in the context of a bunch of expected vs actual comparison data points where the expected values derived from some earlier implementation of the code.
    – jxramos
    Sep 17, 2016 at 1:55
  • I, too, usually name the variables in my unit tests expected and actual. It seems most obvious to me.
    – 5gon12eder
    Sep 17, 2016 at 2:24
  • 1
    Same here, but we actually use nominal for expected
    – tofro
    Sep 17, 2016 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.