OUTPUT:
RETVAL
+SV *
+get_case_cnt (sfr)
+ struct sysreader_info *sfr;
+CODE:
+ SV *ret;
+ casenumber n = casereader_get_case_cnt (sfr->reader);
+ if (n == CASENUMBER_MAX)
+ ret = &PL_sv_undef;
+ else
+ ret = newSViv (n);
+ RETVAL = ret;
+ OUTPUT:
+RETVAL
+
+
void
get_next_case (sfr)
It creates and returns a PSPP::Reader object which can be used to read
data and dictionary information from C<filename>.
+=head3 get_case_cnt ()
+
+Returns the number of cases in a open system file. Some files
+do not store the number of cases. In these instances undef
+will be returned. Therefore, then programmer must check that the
+returned value is not undef before using it.
+
=cut
sub get_dict
# change 'tests => 1' to 'tests => last_test_to_print';
-use Test::More tests => 36;
+use Test::More tests => 37;
use Text::Diff;
use File::Temp qw/ tempfile tempdir /;
BEGIN { use_ok('PSPP') };
nationality =>foreign
size =>large
EOF
+}
+
+
+# Test of the get_case_cnt function
+{
+ my $tempdir = tempdir( CLEANUP => 1 );
+
+ generate_sav_file ("$tempdir/in.sav", "$tempdir");
+
+ my $sf = PSPP::Reader->open ("$tempdir/in.sav");
+
+ my $n = $sf->get_case_cnt ();
+ ok ($n == 5, "Case count");
}
# Skip this test if Perl's Text::Diff module is not installed.
AT_CHECK([perl -MText::Diff -e '' || exit 77])
AT_CHECK([RUN_PERL_MODULE $abs_top_builddir/perl-module/t/Pspp.t], [0],
- [[1..36
+ [[1..37
ok 1 - use PSPP;
ok 2 - Dictionary Creation
ok 3
ok 34 - Missing Value Positive SYS
ok 35 - Missing Value Positive Num
ok 36 - Custom Attributes
-]],
- [[# @&t@
-# @@ -0,0 +1 @@
-# +
-# @@ -0,0 +1 @@
-# +
-# @@ -0,0 +1 @@
-# +
-# @@ -0,0 +1 @@
-# +
-]])
+ok 37 - Case count
+]],[ignore])
AT_CLEANUP