<commit_before>/* This is part of the netCDF package. Copyright 2016 University
   Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
   conditions of use. See www.unidata.ucar.edu for more info.

   Test nc_inq_type

   Added in support of https://github.com/Unidata/netcdf/issues/240

*/

#include <stdlib.h>
#include <string.h>

#include "config.h"
#include <nc_tests.h>
#include <netcdf.h>

#ifdef USE_PNETCDF
#include <netcdf_par.h>
#endif

#define FILE_NAME "tst_inq_type.nc"

void
check_err(const int stat, const int line, const char *file) {
   if (stat != NC_NOERR) {
      (void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat));
      fflush(stderr);
      exit(1);
   }
}


int main(int argc, char **argv) {

  int ncid=0;

  printf("\n* Testing nc_inq_type\n");

  if(nc_create(FILE_NAME,NC_WRITE,&ncid)) ERR;

  printf("\t* Testing NC_INT:\t");
  if(nc_inq_type(0,NC_INT,NULL,NULL))ERR;
  else printf("success.\n");

  printf("\t* Testing NC_INT64:\t");
  if(nc_inq_type(0,NC_INT64,NULL,NULL))ERR;
  else printf("success.\n");

  printf("* Finished.\n");
  return 0;
}<commit_msg>Fleshed out test for nc_inq_type<commit_after>/* This is part of the netCDF package. Copyright 2016 University
   Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
   conditions of use. See www.unidata.ucar.edu for more info.

   Test nc_inq_type

   Added in support of https://github.com/Unidata/netcdf/issues/240

*/

#include <stdlib.h>
#include <string.h>

#include "config.h"
#include <nc_tests.h>
#include <netcdf.h>

#ifdef USE_PNETCDF
#include <netcdf_par.h>
#endif

#define FILE_NAME "tst_inq_type.nc"

void
check_err(const int stat, const int line, const char *file) {
   if (stat != NC_NOERR) {
      (void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat));
      fflush(stderr);
      exit(1);
   }
}

int test_type(int type, char* tstring) {

  printf("\t* Testing Type %s:\t",tstring);
  if(nc_inq_type(0,type,NULL,NULL)) ERR;
  else printf("success.\n");

  return 0;
}



int main(int argc, char **argv) {

  int ncid=0;

  printf("\n* Testing nc_inq_type\n");

  if(nc_create(FILE_NAME,NC_WRITE,&ncid)) ERR;

  test_type(NC_BYTE,"NC_BYTE");
  test_type(NC_CHAR,"NC_CHAR");
  test_type(NC_SHORT,"NC_SHORT");
  test_type(NC_INT,"NC_INT");
  test_type(NC_LONG,"NC_LONG");
  test_type(NC_FLOAT,"NC_FLOAT");
  test_type(NC_DOUBLE,"NC_DOUBLE");
  test_type(NC_UBYTE,"NC_UBYTE");
  test_type(NC_USHORT,"NC_USHORT");
  test_type(NC_UINT,"NC_UINT");
  test_type(NC_INT64,"NC_INT64");
  test_type(NC_UINT64,"NC_UINT64");
  test_type(NC_STRING,"NC_STRING");


  printf("* Finished.\n");
  if(nc_close(ncid)) ERR;

  SUMMARIZE_ERR;
  FINAL_RESULTS;
}
{'fraction_non_alphanumeric': 0.1509364671318399, 'fraction_numerical': 0.012853470437017995, 'mean_word_length': 4.536585365853658, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '733444', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1087, 'n_words': 228}