diff --git a/t/lib/CRMS/RightsPredictor.t b/t/lib/CRMS/RightsPredictor.t index a0197dca..222765c5 100644 --- a/t/lib/CRMS/RightsPredictor.t +++ b/t/lib/CRMS/RightsPredictor.t @@ -28,86 +28,120 @@ subtest 'RightsPredictor::last_source_copyright' => sub { my $f008 = '850423s1940 uk a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000); - is($rp->last_source_copyright, 2070); + is($rp->last_source_copyright, 2070, 'UK baseline 70-year term'); }; + subtest 'UK corporate work' => sub { + my $f008 = '850423s1940 uk a 000 0 eng d'; + my $record = FakeMetadata::fake_record_with_008_and_leader($f008); + my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000, is_corporate => 1); + is($rp->last_source_copyright, 2070, 'UK corporate/anonymous 70-year term'); + }; + subtest 'UK crown' => sub { my $f008 = '850423s1940 uk a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000, is_crown => 1); - is($rp->last_source_copyright, 2050); + is($rp->last_source_copyright, 2050, 'UK crown copyright 50-year term'); }; subtest 'Canada pre-1972' => sub { my $f008 = '850423s1940 cn a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1970); - is($rp->last_source_copyright, 2020); + is($rp->last_source_copyright, 2020, 'Canada has 50-year term when the effective date is prior to 1972'); }; subtest 'Canada 1972 author death date' => sub { my $f008 = '850423s1940 cn a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1972); - is($rp->last_source_copyright, 2042); + is($rp->last_source_copyright, 2042, 'Canada has 70-year term for author death dates on or after 1972'); }; subtest 'Canada 1972 corporate work' => sub { my $f008 = '850423s1940 cn a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); - my $rp = CRMS::RightsPredictor->new(record => $record); - my $res = $rp->last_source_copyright(1972, 1); - is($res->{last_source_copyright_year}, 2047, 'Canada has 75-year term for corporate/anonymous works published on or after 1972'); + my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1972, is_corporate => 1); + is($rp->last_source_copyright, 2047, 'Canada has 75-year term for corporate/anonymous works published on or after 1972'); }; subtest 'Canada post-1972 author death date' => sub { my $f008 = '850423s1940 cn a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000); - is($rp->last_source_copyright, 2070); + is($rp->last_source_copyright, 2070, 'Canada has 70-year term for author death dates on or after 1972'); }; - + subtest 'Canada post-1972 corporate work' => sub { my $f008 = '850423s1940 cn a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); - my $rp = CRMS::RightsPredictor->new(record => $record, is_corporate => 1, effective_date => 2000); - is($rp->last_source_copyright, 2075); + my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000, is_corporate => 1); + is($rp->last_source_copyright, 2075, 'Canada has 75-year term for corporate/anonymous works published on or after 1972'); }; - subtest 'Canada post-1972 corporate work' => sub { + subtest 'Canada pre-1972 crown' => sub { + my $f008 = '850423s1940 cn a 000 0 eng d'; + my $record = FakeMetadata::fake_record_with_008_and_leader($f008); + my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1970, is_crown => 1); + is($rp->last_source_copyright, 2020, 'Canada has 50-year term for crown copyright works regardless of effective date'); + }; + + subtest 'Canada 1972 crown' => sub { + my $f008 = '850423s1940 cn a 000 0 eng d'; + my $record = FakeMetadata::fake_record_with_008_and_leader($f008); + my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1972, is_crown => 1); + is($rp->last_source_copyright, 2022, 'Canada has 50-year term for crown copyright works regardless of effective date'); + }; + + subtest 'Canada post-1972 crown' => sub { my $f008 = '850423s1940 cn a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000, is_crown => 1); - is($rp->last_source_copyright, 2050); + is($rp->last_source_copyright, 2050, 'Canada has 50-year term for crown copyright works regardless of effective date'); }; subtest 'Australia pre-1955' => sub { my $f008 = '850423s1940 at a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1950); - is($rp->last_source_copyright, 2000); + is($rp->last_source_copyright, 2000, 'Australia has 50-year term when the effective date is prior to 1955'); }; subtest 'Australia 1955' => sub { my $f008 = '850423s1940 at a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1955); - is($rp->last_source_copyright, 2025); + is($rp->last_source_copyright, 2025, 'Australia has 70-year term when the effective date is on or after 1955'); }; subtest 'Australia post-1955' => sub { my $f008 = '850423s1940 at a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000); - is($rp->last_source_copyright, 2070); + is($rp->last_source_copyright, 2070, 'Australia has 70-year term when the effective date is on or after 1955'); }; subtest 'Australia pre-1955 crown' => sub { my $f008 = '850423s1940 at a 000 0 eng d'; my $record = FakeMetadata::fake_record_with_008_and_leader($f008); my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000, is_crown => 1); - is($rp->last_source_copyright, 2050); + is($rp->last_source_copyright, 2050, 'Australia has 50-year term for crown copyright works regardless of effective date'); + }; + + subtest 'Australia 1955 crown' => sub { + my $f008 = '850423s1940 at a 000 0 eng d'; + my $record = FakeMetadata::fake_record_with_008_and_leader($f008); + my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 1955, is_crown => 1); + is($rp->last_source_copyright, 2005, 'Australia has 50-year term for crown copyright works regardless of effective date'); + }; + + subtest 'Australia post-1955 crown' => sub { + my $f008 = '850423s1940 at a 000 0 eng d'; + my $record = FakeMetadata::fake_record_with_008_and_leader($f008); + my $rp = CRMS::RightsPredictor->new(record => $record, effective_date => 2000, is_crown => 1); + is($rp->last_source_copyright, 2050, 'Australia has 50-year term for crown copyright works regardless of effective date'); }; subtest 'Unknown country' => sub {