test_file_get_contents ()
{
  gchar * D.5871;
  struct GError * error.0;
  gchar * content.1;
  gchar * D.5880;
  int D.5881;
  long unsigned int D.5886;
  long unsigned int length.2;
  long unsigned int D.5890;
  struct GError * error;
  gchar * content;
  gboolean ret;
  gsize length;
  const gchar * filename;

  try
    {
      filename = "/etc/hosts";
      error = 0B;
      ret = monoeg_g_file_get_contents ("", &content, 0B, &error);
      if (ret != 0) goto <D.5869>; else goto <D.5870>;
      <D.5869>:
      D.5871 = FAILED ("HAH!");
      return D.5871;
      <D.5870>:
      error.0 = error;
      if (error.0 == 0B) goto <D.5873>; else goto <D.5874>;
      <D.5873>:
      D.5871 = FAILED ("Got nothing as error.");
      return D.5871;
      <D.5874>:
      content.1 = content;
      if (content.1 != 0B) goto <D.5876>; else goto <D.5877>;
      <D.5876>:
      D.5871 = FAILED ("Content is uninitialized");
      return D.5871;
      <D.5877>:
      error.0 = error;
      monoeg_g_error_free (error.0);
      error = 0B;
      ret = monoeg_g_file_get_contents (filename, &content, &length, &error);
      if (ret == 0) goto <D.5878>; else goto <D.5879>;
      <D.5878>:
      error.0 = error;
      D.5880 = error.0->message;
      error.0 = error;
      D.5881 = error.0->code;
      D.5871 = FAILED ("The error is %d %s\n", D.5881, D.5880);
      return D.5871;
      <D.5879>:
      error.0 = error;
      if (error.0 != 0B) goto <D.5882>; else goto <D.5883>;
      <D.5882>:
      D.5871 = FAILED ("Got an error returning TRUE");
      return D.5871;
      <D.5883>:
      content.1 = content;
      if (content.1 == 0B) goto <D.5884>; else goto <D.5885>;
      <D.5884>:
      D.5871 = FAILED ("Content is NULL");
      return D.5871;
      <D.5885>:
      content.1 = content;
      D.5886 = strlen (content.1);
      length.2 = length;
      if (D.5886 != length.2) goto <D.5888>; else goto <D.5889>;
      <D.5888>:
      content.1 = content;
      D.5890 = strlen (content.1);
      length.2 = length;
      D.5871 = FAILED ("length is %d but the string is %d", length.2, D.5890);
      return D.5871;
      <D.5889>:
      content.1 = content;
      monoeg_g_free (content.1);
      D.5871 = 0B;
      return D.5871;
    }
  finally
    {
      error = {CLOBBER};
      content = {CLOBBER};
      length = {CLOBBER};
    }
}


test_open_tmp ()
{
  gchar * D.5895;
  struct GError * error.3;
  gchar * name.4;
  struct GError * error;
  gint fd;
  gchar * name;

  try
    {
      name = -1B;
      error = 0B;
      fd = monoeg_g_file_open_tmp ("invalidtemplate", 0B, &error);
      if (fd != -1) goto <D.5893>; else goto <D.5894>;
      <D.5893>:
      D.5895 = FAILED ("The template was invalid and accepted");
      return D.5895;
      <D.5894>:
      error.3 = error;
      if (error.3 == 0B) goto <D.5897>; else goto <D.5898>;
      <D.5897>:
      D.5895 = FAILED ("No error returned.");
      return D.5895;
      <D.5898>:
      error.3 = error;
      monoeg_g_error_free (error.3);
      error = 0B;
      fd = monoeg_g_file_open_tmp ("i/nvalidtemplate", &name, &error);
      if (fd != -1) goto <D.5899>; else goto <D.5900>;
      <D.5899>:
      D.5895 = FAILED ("The template was invalid and accepted");
      return D.5895;
      <D.5900>:
      error.3 = error;
      if (error.3 == 0B) goto <D.5901>; else goto <D.5902>;
      <D.5901>:
      D.5895 = FAILED ("No error returned.");
      return D.5895;
      <D.5902>:
      name.4 = name;
      if (name.4 == 0B) goto <D.5904>; else goto <D.5905>;
      <D.5904>:
      D.5895 = FAILED ("\'name\' is not reset");
      return D.5895;
      <D.5905>:
      error.3 = error;
      monoeg_g_error_free (error.3);
      error = 0B;
      fd = monoeg_g_file_open_tmp ("valid-XXXXXX", &name, &error);
      if (fd == -1) goto <D.5906>; else goto <D.5907>;
      <D.5906>:
      D.5895 = FAILED ("This should be valid");
      return D.5895;
      <D.5907>:
      error.3 = error;
      if (error.3 != 0B) goto <D.5908>; else goto <D.5909>;
      <D.5908>:
      D.5895 = FAILED ("No error returned.");
      return D.5895;
      <D.5909>:
      name.4 = name;
      if (name.4 == 0B) goto <D.5910>; else goto <D.5911>;
      <D.5910>:
      D.5895 = FAILED ("No name returned.");
      return D.5895;
      <D.5911>:
      close (fd);
      name.4 = name;
      unlink (name.4);
      name.4 = name;
      monoeg_g_free (name.4);
      D.5895 = 0B;
      return D.5895;
    }
  finally
    {
      error = {CLOBBER};
      name = {CLOBBER};
    }
}


test_file ()
{
  gchar * D.5916;
  int D.5935;
  gchar * path.5;
  gboolean res;
  const gchar * tmp;
  gchar * path;
  gchar * sympath;
  gint ignored;

  try
    {
      res = monoeg_g_file_test (0B, 0);
      if (res != 0) goto <D.5914>; else goto <D.5915>;
      <D.5914>:
      D.5916 = FAILED ("Should return FALSE HERE");
      return D.5916;
      <D.5915>:
      res = monoeg_g_file_test ("file.c", 0);
      if (res != 0) goto <D.5917>; else goto <D.5918>;
      <D.5917>:
      D.5916 = FAILED ("Should return FALSE HERE");
      return D.5916;
      <D.5918>:
      tmp = monoeg_g_get_tmp_dir ();
      res = monoeg_g_file_test (tmp, 16);
      if (res == 0) goto <D.5919>; else goto <D.5920>;
      <D.5919>:
      D.5916 = FAILED ("tmp does not exist.");
      return D.5916;
      <D.5920>:
      res = monoeg_g_file_test (tmp, 1);
      if (res != 0) goto <D.5921>; else goto <D.5922>;
      <D.5921>:
      D.5916 = FAILED ("tmp is regular");
      return D.5916;
      <D.5922>:
      res = monoeg_g_file_test (tmp, 4);
      if (res == 0) goto <D.5923>; else goto <D.5924>;
      <D.5923>:
      D.5916 = FAILED ("tmp is not a directory");
      return D.5916;
      <D.5924>:
      res = monoeg_g_file_test (tmp, 8);
      if (res == 0) goto <D.5925>; else goto <D.5926>;
      <D.5925>:
      D.5916 = FAILED ("tmp is not a executable");
      return D.5916;
      <D.5926>:
      res = monoeg_g_file_test (tmp, 18);
      if (res == 0) goto <D.5927>; else goto <D.5928>;
      <D.5927>:
      D.5916 = FAILED ("2 tmp does not exist.");
      return D.5916;
      <D.5928>:
      res = monoeg_g_file_test (tmp, 3);
      if (res != 0) goto <D.5929>; else goto <D.5930>;
      <D.5929>:
      D.5916 = FAILED ("2 tmp is regular");
      return D.5916;
      <D.5930>:
      res = monoeg_g_file_test (tmp, 6);
      if (res == 0) goto <D.5931>; else goto <D.5932>;
      <D.5931>:
      D.5916 = FAILED ("2 tmp is not a directory");
      return D.5916;
      <D.5932>:
      res = monoeg_g_file_test (tmp, 10);
      if (res == 0) goto <D.5933>; else goto <D.5934>;
      <D.5933>:
      D.5916 = FAILED ("2 tmp is not a executable");
      return D.5916;
      <D.5934>:
      D.5935 = monoeg_g_file_open_tmp (0B, &path, 0B);
      close (D.5935);
      path.5 = path;
      res = monoeg_g_file_test (path.5, 16);
      if (res == 0) goto <D.5937>; else goto <D.5938>;
      <D.5937>:
      path.5 = path;
      D.5916 = FAILED ("3 %s should exist", path.5);
      return D.5916;
      <D.5938>:
      path.5 = path;
      res = monoeg_g_file_test (path.5, 1);
      if (res == 0) goto <D.5939>; else goto <D.5940>;
      <D.5939>:
      path.5 = path;
      D.5916 = FAILED ("3 %s IS_REGULAR", path.5);
      return D.5916;
      <D.5940>:
      path.5 = path;
      res = monoeg_g_file_test (path.5, 4);
      if (res != 0) goto <D.5941>; else goto <D.5942>;
      <D.5941>:
      path.5 = path;
      D.5916 = FAILED ("3 %s should not be a directory", path.5);
      return D.5916;
      <D.5942>:
      path.5 = path;
      res = monoeg_g_file_test (path.5, 8);
      if (res != 0) goto <D.5943>; else goto <D.5944>;
      <D.5943>:
      path.5 = path;
      D.5916 = FAILED ("3 %s should not be executable", path.5);
      return D.5916;
      <D.5944>:
      path.5 = path;
      res = monoeg_g_file_test (path.5, 2);
      if (res != 0) goto <D.5945>; else goto <D.5946>;
      <D.5945>:
      path.5 = path;
      D.5916 = FAILED ("3 %s should not be a symlink", path.5);
      return D.5916;
      <D.5946>:
      path.5 = path;
      sympath = monoeg_g_strconcat (path.5, "-link", 0B);
      path.5 = path;
      ignored = symlink (path.5, sympath);
      res = monoeg_g_file_test (sympath, 16);
      if (res == 0) goto <D.5947>; else goto <D.5948>;
      <D.5947>:
      D.5916 = FAILED ("4 %s should not exist", sympath);
      return D.5916;
      <D.5948>:
      res = monoeg_g_file_test (sympath, 1);
      if (res == 0) goto <D.5949>; else goto <D.5950>;
      <D.5949>:
      D.5916 = FAILED ("4 %s should not be a regular file", sympath);
      return D.5916;
      <D.5950>:
      res = monoeg_g_file_test (sympath, 4);
      if (res != 0) goto <D.5951>; else goto <D.5952>;
      <D.5951>:
      D.5916 = FAILED ("4 %s should not be a directory", sympath);
      return D.5916;
      <D.5952>:
      res = monoeg_g_file_test (sympath, 8);
      if (res != 0) goto <D.5953>; else goto <D.5954>;
      <D.5953>:
      D.5916 = FAILED ("4 %s should not be executable", sympath);
      return D.5916;
      <D.5954>:
      res = monoeg_g_file_test (sympath, 2);
      if (res == 0) goto <D.5955>; else goto <D.5956>;
      <D.5955>:
      D.5916 = FAILED ("4 %s should be a symlink", sympath);
      return D.5916;
      <D.5956>:
      path.5 = path;
      unlink (path.5);
      res = monoeg_g_file_test (sympath, 16);
      if (res != 0) goto <D.5957>; else goto <D.5958>;
      <D.5957>:
      D.5916 = FAILED ("5 %s should exist", sympath);
      return D.5916;
      <D.5958>:
      res = monoeg_g_file_test (sympath, 1);
      if (res != 0) goto <D.5959>; else goto <D.5960>;
      <D.5959>:
      D.5916 = FAILED ("5 %s should be a regular file", sympath);
      return D.5916;
      <D.5960>:
      res = monoeg_g_file_test (sympath, 4);
      if (res != 0) goto <D.5961>; else goto <D.5962>;
      <D.5961>:
      D.5916 = FAILED ("5 %s should not be a directory", sympath);
      return D.5916;
      <D.5962>:
      res = monoeg_g_file_test (sympath, 8);
      if (res != 0) goto <D.5963>; else goto <D.5964>;
      <D.5963>:
      D.5916 = FAILED ("5 %s should not be executable", sympath);
      return D.5916;
      <D.5964>:
      res = monoeg_g_file_test (sympath, 2);
      if (res == 0) goto <D.5965>; else goto <D.5966>;
      <D.5965>:
      D.5916 = FAILED ("5 %s should be a symlink", sympath);
      return D.5916;
      <D.5966>:
      unlink (sympath);
      monoeg_g_free (sympath);
      path.5 = path;
      monoeg_g_free (path.5);
      D.5916 = 0B;
      return D.5916;
    }
  finally
    {
      path = {CLOBBER};
    }
}


file_tests_init ()
{
  struct Test * D.5969;

  D.5969 = &file_tests;
  return D.5969;
}


