text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE563_Unused_Variable__unused_value_struct_82a.cpp
  Label Definition File: CWE563_Unused_Variable__unused_value.label.xml
  Template File: sources-sinks-82a.tmpl.cpp
  */
  /*
   * @description
   * CWE: 563 Unused Variable
   * BadSource:  Initialize data
   * GoodSource: Initialize and use data
   * Sinks:
   *    GoodSink: Use data
   *    BadSink : Initialize and use data
   * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
   *
   * */
  
  #include "std_testcase.h"
  #include "CWE563_Unused_Variable__unused_value_struct_82.h"
  
  namespace CWE563_Unused_Variable__unused_value_struct_82
  {
  
  #ifndef OMITBAD
  
  void bad()
  {
      twoIntsStruct data;
      /* POTENTIAL FLAW: Initialize, but do not use data */
      data.intOne = 0;
      data.intTwo = 0;
      CWE563_Unused_Variable__unused_value_struct_82_base* baseObject = new CWE563_Unused_Variable__unused_value_struct_82_bad;
      baseObject->action(data);
      delete baseObject;
  }
  
  #endif /* OMITBAD */
  
  #ifndef OMITGOOD
  
  /* goodG2B uses the GoodSource with the BadSink */
  static void goodG2B()
  {
      twoIntsStruct data;
      /* FIX: Initialize and use data before it is overwritten */
      data.intOne = 0;
      data.intTwo = 0;
      printStructLine(&data);
      CWE563_Unused_Variable__unused_value_struct_82_base* baseObject = new CWE563_Unused_Variable__unused_value_struct_82_goodG2B;
      baseObject->action(data);
      delete baseObject;
  }
  
  /* goodB2G uses the BadSource with the GoodSink */
  static void goodB2G()
  {
      twoIntsStruct data;
      /* POTENTIAL FLAW: Initialize, but do not use data */
      data.intOne = 0;
      data.intTwo = 0;
      CWE563_Unused_Variable__unused_value_struct_82_base* baseObject = new CWE563_Unused_Variable__unused_value_struct_82_goodB2G;
      baseObject->action(data);
      delete baseObject;
  }
  
  void good()
  {
      goodG2B();
      goodB2G();
  }
  
  #endif /* OMITGOOD */
  
  } /* close namespace */
  
  /* Below is the main(). It is only used when building this testcase on
     its own for testing or for building a binary to use in testing binary
     analysis tools. It is not used when compiling all the testcases as one
     application, which is how source code analysis tools are tested. */
  
  #ifdef INCLUDEMAIN
  
  using namespace CWE563_Unused_Variable__unused_value_struct_82; /* so that we can use good and bad easily */
  
  int main(int argc, char * argv[])
  {
      /* seed randomness */
      srand( (unsigned)time(NULL) );
  #ifndef OMITGOOD
      printLine("Calling good()...");
      good();
      printLine("Finished good()");
  #endif /* OMITGOOD */
  #ifndef OMITBAD
      printLine("Calling bad()...");
      bad();
      printLine("Finished bad()");
  #endif /* OMITBAD */
      return 0;
  }
  
  #endif
  