@@ -119,6 +119,8 @@ export const ClusteredSRMAccordionViewer: React.FC<any> = ({
119119 const [ error , setError ] = useState < string | null > ( null ) ;
120120
121121 const [ limitOracles , setLimitOracles ] = useState ( false ) ;
122+ const [ mutants , setMutants ] = useState < CodeVersion [ ] > ( [ ] ) ;
123+ const [ mutantsKilled , setMutantsKilled ] = useState < number > ( 0 ) ;
122124
123125 const [ queryResponse , setQueryResponse ] = useState < SearchSrmQueryResponse > ( )
124126
@@ -360,6 +362,22 @@ SELECT count(*) AS cluster_size, list(SYSTEMID) AS cluster_implementations, * EX
360362 const nonOriginalImpls = allImpls . filter ( i => i . variantId !== 'original' ) ;
361363 const sortedImplsOriginal = [ ...originalImpls , ...nonOriginalImpls ] ;
362364
365+ // identify if mutants are present
366+ const mutantImpls = allImpls . filter ( i => i . variantId . startsWith ( 'mutant' ) ) ;
367+ if ( mutantImpls && mutantImpls . length > 0 ) {
368+ setMutants ( mutantImpls ) ;
369+
370+ if ( clusters . length > 0 ) {
371+ const clusterImpls = clusters . map ( ( cluster ) => parseDuckDBList ( cluster . cluster_implementations ) ) . find ( ( impls ) => {
372+ return impls . find ( ( impl ) => impl . variantId === 'original' ) ;
373+ } ) ;
374+ // FIXME identify cluster of original implementation
375+ console . log ( "Found cluster of original impl " + clusterImpls . length ) ;
376+
377+ setMutantsKilled ( mutantImpls . length - clusterImpls . length - 1 ) ;
378+ }
379+ }
380+
363381 const oracleImpls = sortedImplsOriginal . filter ( i => i . id === 'oracle' ) ;
364382 const nonOracleImpls = sortedImplsOriginal . filter ( i => i . id !== 'oracle' ) ;
365383 const sortedImpls = [ ...oracleImpls , ...nonOracleImpls ] ;
@@ -657,57 +675,85 @@ SELECT count(*) AS cluster_size, list(SYSTEMID) AS cluster_implementations, * EX
657675
658676 { /* --- Cluster Statistics Panel --- */ }
659677 { clusters . length > 0 && (
660- < Box mb = { 2 } >
661- < Typography variant = "h6" gutterBottom > Cluster Statistics</ Typography >
662- < Table size = "small" sx = { { width : 'auto' , mb : 1 } } >
663- < TableHead >
664- < TableRow >
665- < TableCell > Color</ TableCell >
666- < TableCell > Cluster #</ TableCell >
667- < TableCell > Number of Implementations</ TableCell >
668- < TableCell > Implementations</ TableCell >
669- </ TableRow >
670- </ TableHead >
671- < TableBody >
672- { clusters . map ( ( cluster , idx ) => {
673- const clusterColor = getClusterColor ( idx ) ;
674- const implementations = parseDuckDBList ( cluster . cluster_implementations ) ;
675- return (
676- < TableRow key = { idx } >
677- < TableCell >
678- < Box sx = { {
679- background : clusterColor ,
680- width : 28 , height : 18 , borderRadius : '4px' , border : '1px solid #bbb'
681- } } />
682- </ TableCell >
683- < TableCell > Cluster { idx + 1 } </ TableCell >
684- < TableCell > { implementations . length } </ TableCell >
685- < TableCell >
686- { implementations . map ( i => `${ i . id } (${ i . variantId } )` ) . join ( ", " ) }
687- </ TableCell >
688- </ TableRow >
689- ) ;
690- } ) }
691- </ TableBody >
692- </ Table >
693- < Typography variant = "body2" >
694- Total number of test cases: < b > {
695- ( ( ) => {
696- // All test invocation labels from all clusters
697- const set = new Set ( ) ;
698- clusters . forEach ( cluster => {
699- Object . keys ( cluster ) . forEach ( key => {
700- if ( ! [ 'id' , 'cluster_implementations' , 'cluster_size' , 'ABSTRACTIONID' , 'unique_values' ] . includes ( key ) ) {
701- const testCase = key . split ( '@' ) [ 0 ] ;
702- set . add ( testCase ) ;
703- }
678+ < >
679+ { mutants . length > 0 && (
680+ < Box mb = { 2 } >
681+ < Typography variant = "h6" gutterBottom > Mutation Coverage</ Typography >
682+
683+ < Typography variant = "body2" >
684+ Total number of mutants: < b > { mutants . length } </ b >
685+ </ Typography >
686+ < Typography variant = "body2" >
687+ Total number of killed mutants: < b > { mutantsKilled } </ b >
688+ </ Typography >
689+ < Typography variant = "body2" >
690+ Mutation Score: < b > { mutantsKilled / mutants . length } </ b >
691+ </ Typography >
692+ </ Box >
693+ ) }
694+
695+ < Box mb = { 2 } >
696+
697+ < Typography variant = "h6" gutterBottom > Cluster Statistics</ Typography >
698+ < Typography variant = "body2" >
699+ Total number of test cases: < b > {
700+ ( ( ) => {
701+ // All test invocation labels from all clusters
702+ const set = new Set ( ) ;
703+ clusters . forEach ( cluster => {
704+ Object . keys ( cluster ) . forEach ( key => {
705+ if ( ! [ 'id' , 'cluster_implementations' , 'cluster_size' , 'ABSTRACTIONID' , 'unique_values' ] . includes ( key ) ) {
706+ const testCase = key . split ( '@' ) [ 0 ] ;
707+ set . add ( testCase ) ;
708+ }
709+ } ) ;
704710 } ) ;
705- } ) ;
706- return set . size ;
707- } ) ( )
708- } </ b >
709- </ Typography >
710- </ Box >
711+ return set . size ;
712+ } ) ( )
713+ } </ b >
714+ </ Typography >
715+ < Typography variant = "body2" >
716+ Total number of code modules: < b > {
717+ ( ( ) => {
718+ return clusters . flatMap ( cluster => {
719+ return parseDuckDBList ( cluster . cluster_implementations ) ;
720+ } ) . length ;
721+ } ) ( )
722+ } </ b >
723+ </ Typography >
724+ < br />
725+ < Table size = "small" sx = { { width : 'auto' , mb : 1 } } >
726+ < TableHead >
727+ < TableRow >
728+ < TableCell > Color</ TableCell >
729+ < TableCell > Cluster #</ TableCell >
730+ < TableCell > Number of Implementations</ TableCell >
731+ < TableCell > Implementations</ TableCell >
732+ </ TableRow >
733+ </ TableHead >
734+ < TableBody >
735+ { clusters . map ( ( cluster , idx ) => {
736+ const clusterColor = getClusterColor ( idx ) ;
737+ const implementations = parseDuckDBList ( cluster . cluster_implementations ) ;
738+ return (
739+ < TableRow key = { idx } >
740+ < TableCell >
741+ < Box sx = { {
742+ background : clusterColor ,
743+ width : 28 , height : 18 , borderRadius : '4px' , border : '1px solid #bbb'
744+ } } />
745+ </ TableCell >
746+ < TableCell > Cluster { idx + 1 } </ TableCell >
747+ < TableCell > { implementations . length } </ TableCell >
748+ < TableCell >
749+ { implementations . map ( i => `${ i . id } (${ i . variantId } )` ) . join ( ", " ) }
750+ </ TableCell >
751+ </ TableRow >
752+ ) ;
753+ } ) }
754+ </ TableBody >
755+ </ Table >
756+ </ Box > </ >
711757 ) }
712758
713759 < Dialog open = { ! ! openTestCase } onClose = { ( ) => setOpenTestCase ( null ) } maxWidth = "md" fullWidth >
0 commit comments