Blame HalfTest/testSize.cpp

Packit 8dc392
#include <testSize.h>
Packit 8dc392
#include "half.h"
Packit 8dc392
#include <iostream>
Packit 8dc392
#include <assert.h>
Packit 8dc392
#include <stddef.h>
Packit 8dc392
Packit 8dc392
Packit 8dc392
using namespace std;
Packit 8dc392
Packit 8dc392
Packit 8dc392
void
Packit 8dc392
testSize ()
Packit 8dc392
{
Packit 8dc392
    cout << "size and alignment\n";
Packit 8dc392
Packit 8dc392
    half h[2];
Packit 8dc392
Packit 8dc392
    int size = sizeof (half);
Packit 8dc392
    ptrdiff_t algn = (char *)&h[1] - (char *)&h[0];
Packit 8dc392
Packit 8dc392
    cout << "sizeof  (half) = " << size << endl;
Packit 8dc392
    cout << "alignof (half) = " << (int) algn << endl;
Packit 8dc392
Packit 8dc392
    assert (size == 2 && algn == 2);
Packit 8dc392
Packit 8dc392
    cout << "ok\n\n" << flush;
Packit 8dc392
}