Example #1
0
  public static void main(String args[]) {
    int arg = 0;
    ArrayList<String> inFile = new ArrayList<String>();

    System.out.printf(
        "FIT Test Tool %d.%d.%d.%d\n",
        Fit.PROTOCOL_VERSION_MAJOR,
        Fit.PROTOCOL_VERSION_MINOR,
        Fit.PROFILE_VERSION_MAJOR,
        Fit.PROFILE_VERSION_MINOR);

    while (arg < args.length) {
      if (args[arg].equals("-d")) {
        Fit.debug = true;
      } else {
        String in = args[arg];
        inFile.add(in);
      }
      arg++;
    }

    if (inFile.size() == 0) {
      printUsage();
      return;
    }

    for (int i = 0; i < inFile.size(); i++) {
      Object stList[] = inFile.toArray();

      System.out.println("Input file: " + ((String) stList[i]));
      try {
        if (!Decode.checkIntegrity((InputStream) new FileInputStream(((String) stList[i]))))
          throw new RuntimeException("FIT file integrity failure.");
      } catch (java.io.IOException e) {
        throw new RuntimeException(e);
      }

      Tests tests = new Tests();
      System.out.println("Running FIT file verification tests...");
      if (tests.run(((String) stList[i]))) System.out.println("Passed FIT file verification.");
      else System.out.println("Failed FIT file verification.");
    }
  }