<commit_before>/*
 * Copyright 2015 Canonical Limited
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the licence, or (at your option) any later version.
 *
 * See the included COPYING file for more information.
 *
 * Author: <NAME> <<EMAIL>>
 */

#include <glib.h>

typedef struct
{
  gboolean success;
  gsize c, a, b;
} Case;

static void
test_checked_guint_add (void)
{
  static const Case cases[] = {
    /*  success                c =               a +             b */
      { TRUE,                  0,                0,              0 },
      { TRUE,           G_MAXINT,         G_MAXINT,              0 },
      { TRUE,           G_MAXINT,                0,       G_MAXINT },
      { TRUE,          G_MAXUINT,        G_MAXUINT,              0 },
      { TRUE,          G_MAXUINT,                0,      G_MAXUINT },
      { TRUE,      G_MAXUINT - 1,         G_MAXINT,       G_MAXINT },
      { FALSE,                 0,        G_MAXUINT,              1 },
      { FALSE,                 0,                1,      G_MAXUINT },
      { FALSE,                 0,        G_MAXUINT,      G_MAXUINT }
  };
  guint i;

  for (i = 0; i < G_N_ELEMENTS (cases); i++)
    {
      guint result;

      g_assert_cmpuint (cases[i].success, ==, g_uint_checked_add (&result, cases[i].a, cases[i].b));
      if (cases[i].success)<commit_msg>tests: fix a test on 32-bit builds<commit_after>/*
 * Copyright 2015 Canonical Limited
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the licence, or (at your option) any later version.
 *
 * See the included COPYING file for more information.
 *
 * Author: <NAME> <<EMAIL>>
 */

#include <glib.h>

typedef struct
{
  gboolean success;
  guint64 c, a, b;
} Case;

static void
test_checked_guint_add (void)
{
  static const Case cases[] = {
    /*  success                c =               a +             b */
      { TRUE,                  0,                0,              0 },
      { TRUE,           G_MAXINT,         G_MAXINT,              0 },
      { TRUE,           G_MAXINT,                0,       G_MAXINT },
      { TRUE,          G_MAXUINT,        G_MAXUINT,              0 },
      { TRUE,          G_MAXUINT,                0,      G_MAXUINT },
      { TRUE,      G_MAXUINT - 1,         G_MAXINT,       G_MAXINT },
      { FALSE,                 0,        G_MAXUINT,              1 },
      { FALSE,                 0,                1,      G_MAXUINT },
      { FALSE,                 0,        G_MAXUINT,      G_MAXUINT }
  };
  guint i;

  for (i = 0; i < G_N_ELEMENTS (cases); i++)
    {
      guint result;

      g_assert_cmpuint (cases[i].success, ==, g_uint_checked_add (&result, cases[i].a, cases[i].b));
      if (cases[i].success)
{'fraction_non_alphanumeric': 0.10082918739635158, 'fraction_numerical': 0.013930348258706468, 'mean_word_length': 1.3898573692551506, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1837436', 'n_tokens_mistral': 936, 'n_tokens_neox': 895, 'n_words': 279}