@@ -473,5 +473,39 @@ public void TestComputations_WithNegativeNumbers_MaxMin_Calculated(int startingF
473473 // We need to iterate over all range with conversion to ushort due to negative numbers issue
474474 Assert . Equal ( ( ushort ) ushortColumn . Min ( ) , range . Select ( x => ( ushort ) x ) . Min ( ) ) ;
475475 }
476+
477+ [ Fact ]
478+ public void Test_Logical_Computation_And ( )
479+ {
480+ var col1 = new BooleanDataFrameColumn ( "col1" , new Boolean [ ] { true , false , true } ) ;
481+ var col2 = new BooleanDataFrameColumn ( "col2" , new Boolean [ ] { false , true , true } ) ;
482+ var dfTest = new DataFrame ( col1 , col2 ) ;
483+ var col3 = dfTest [ "col1" ] . And ( dfTest [ "col2" ] ) ;
484+ var col4 = col1 . And ( col2 ) ;
485+
486+ for ( int i = 0 ; i < col1 . Length ; i ++ )
487+ {
488+ var exprectedValue = col1 [ i ] & col2 [ i ] ;
489+ Assert . Equal ( exprectedValue , col3 [ i ] ) ;
490+ Assert . Equal ( exprectedValue , col4 [ i ] ) ;
491+ }
492+ }
493+
494+ [ Fact ]
495+ public void Test_Logical_Computation_Or ( )
496+ {
497+ var col1 = new BooleanDataFrameColumn ( "col1" , new Boolean [ ] { true , false , true } ) ;
498+ var col2 = new BooleanDataFrameColumn ( "col2" , new Boolean [ ] { false , true , true } ) ;
499+ var dfTest = new DataFrame ( col1 , col2 ) ;
500+ var col3 = dfTest [ "col1" ] . Or ( dfTest [ "col2" ] ) ;
501+ var col4 = col1 . Or ( col2 ) ;
502+
503+ for ( int i = 0 ; i < col1 . Length ; i ++ )
504+ {
505+ var exprectedValue = col1 [ i ] | col2 [ i ] ;
506+ Assert . Equal ( exprectedValue , col3 [ i ] ) ;
507+ Assert . Equal ( exprectedValue , col4 [ i ] ) ;
508+ }
509+ }
476510 }
477511}
0 commit comments