cleanup
[platform/upstream/glib.git] / tests / type-test.c
index ade1b86..e767f0f 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -24,6 +22,7 @@
  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#undef G_DISABLE_ASSERT
 #undef G_LOG_DOMAIN
 
 #include <stdio.h>
@@ -40,6 +39,7 @@ main (int   argc,
   gushort gus;
   guint gui;
   gulong gul;
+  gsize gsz;
   gshort gs;
   gint gi;
   glong gl;
@@ -49,26 +49,24 @@ main (int   argc,
   gint32 gi32t2;
   guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U;
   guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U;
-#ifdef G_HAVE_GINT64
   guint64 gu64t1 = G_GINT64_CONSTANT(0x1d636b02300a7aa7U),
          gu64t2 = G_GINT64_CONSTANT(0xa77a0a30026b631dU);
   gint64 gi64t1;
   gint64 gi64t2;
-#endif
+  gssize gsst1;
+  gssize gsst2;
+  gsize  gst1;
+  gsize  gst2;
 
   /* type sizes */
   g_assert (sizeof (gint8) == 1);
   g_assert (sizeof (gint16) == 2);
   g_assert (sizeof (gint32) == 4);
-#ifdef G_HAVE_GINT64
   g_assert (sizeof (gint64) == 8);
-#endif /* G_HAVE_GINT64 */
 
   g_assert (GUINT16_SWAP_LE_BE (gu16t1) == gu16t2);
   g_assert (GUINT32_SWAP_LE_BE (gu32t1) == gu32t2);
-#ifdef G_HAVE_GINT64
   g_assert (GUINT64_SWAP_LE_BE (gu64t1) == gu64t2);
-#endif
 
   /* Test the G_(MIN|MAX|MAXU)(SHORT|INT|LONG) macros */
 
@@ -84,6 +82,11 @@ main (int   argc,
   gul++;
   g_assert (gul == 0);
 
+  gsz = G_MAXSIZE;
+  gsz++;
+  
+  g_assert (gsz == 0);
+
   gs = G_MAXSHORT;
   gs++;
   g_assert (gs == G_MINSHORT);
@@ -113,16 +116,25 @@ main (int   argc,
   g_assert (gu16t1 == gu16t2);
   g_assert (gu32t1 == gu32t2);
 
-#if defined (G_HAVE_GINT64) && defined (G_GINT64_FORMAT)
   gi64t1 = G_GINT64_CONSTANT (-0x3AFAFAFAFAFAFAFA);
   gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA); 
+
 #define FORMAT64 "%" G_GINT64_FORMAT " %" G_GUINT64_FORMAT "\n"
   string = g_strdup_printf (FORMAT64, gi64t1, gu64t1);
   sscanf (string, FORMAT64, &gi64t2, &gu64t2);
   g_free (string);
   g_assert (gi64t1 == gi64t2);
   g_assert (gu64t1 == gu64t2);
-#endif
+
+  gsst1 = -0x3AFAFAFA;
+  gst1 = 0xFAFAFAFA; 
+
+#define FORMATSIZE "%" G_GSSIZE_FORMAT " %" G_GSIZE_FORMAT "\n"
+  string = g_strdup_printf (FORMATSIZE, gsst1, gst1);
+  sscanf (string, FORMATSIZE, &gsst2, &gst2);
+  g_free (string);
+  g_assert (gsst1 == gsst2);
+  g_assert (gst1 == gst2);
   
   return 0;
 }