@@ -887,6 +887,13 @@ TEST_CASE ("update") {
887
887
Field f4 = two.clone ();
888
888
f4.min (f3);
889
889
REQUIRE (views_are_equal (f3, f4));
890
+
891
+ // Check that updating with rhs==fill_value ignores the rhs
892
+ f3.deep_copy (constants::fill_value<Real>);
893
+ f3.get_header ().set_extra_data (" mask_value" ,constants::fill_value<Real>);
894
+ f2.deep_copy (1.0 );
895
+ f2.max (f3);
896
+ REQUIRE (views_are_equal (f2,one));
890
897
}
891
898
892
899
SECTION (" int" ) {
@@ -904,6 +911,13 @@ TEST_CASE ("update") {
904
911
Field f4 = two.clone ();
905
912
f4.min (f3);
906
913
REQUIRE (views_are_equal (f3, f4));
914
+
915
+ // Check that updating with rhs==fill_value ignores the rhs
916
+ f3.deep_copy (constants::fill_value<int >);
917
+ f3.get_header ().set_extra_data (" mask_value" ,constants::fill_value<int >);
918
+ f2.deep_copy (1 );
919
+ f2.max (f3);
920
+ REQUIRE (views_are_equal (f2,one));
907
921
}
908
922
}
909
923
@@ -949,6 +963,19 @@ TEST_CASE ("update") {
949
963
// Same, but we discard current content of f3
950
964
f3.update (f_real,2 ,0 );
951
965
REQUIRE (views_are_equal (f3,f2));
966
+
967
+ // Check that updating with rhs==fill_value ignores the rhs
968
+ Field one = f_real.clone ();
969
+ one.deep_copy (1.0 );
970
+
971
+ f3.deep_copy (constants::fill_value<Real>);
972
+ f3.get_header ().set_extra_data (" mask_value" ,constants::fill_value<Real>);
973
+ f2.deep_copy (1.0 );
974
+ f2.update (f3,1 ,1 );
975
+ if (not views_are_equal (f2,one)) {
976
+ print_field_hyperslab (f2);
977
+ }
978
+ REQUIRE (views_are_equal (f2,one));
952
979
}
953
980
954
981
SECTION (" int" ) {
@@ -969,6 +996,15 @@ TEST_CASE ("update") {
969
996
f3.update (f_int,2 ,0 );
970
997
REQUIRE (views_are_equal (f3,f2));
971
998
999
+ // Check that updating with rhs==fill_value ignores the rhs
1000
+ Field one = f_int.clone ();
1001
+ one.deep_copy (1 );
1002
+
1003
+ f3.deep_copy (constants::fill_value<int >);
1004
+ f3.get_header ().set_extra_data (" mask_value" ,constants::fill_value<int >);
1005
+ f2.deep_copy (1 );
1006
+ f2.update (f3,1 ,1 );
1007
+ REQUIRE (views_are_equal (f2,one));
972
1008
}
973
1009
}
974
1010
}
0 commit comments