From ab247860169c8eb62433fcae838d625ff4a59827 Mon Sep 17 00:00:00 2001 From: Alex | Kronox Date: Fri, 8 Nov 2024 11:33:24 +0100 Subject: [PATCH] adjust report viewer unit tests --- .../comparisonTable/ComparisonTable.test.ts | 60 ++++++++-------- .../ComparisonTableFilter.test.ts | 24 +++++-- .../optionsSelectors/MetricSelector.test.ts | 14 ++-- .../model/factories/ComparisonFactory.test.ts | 12 +++- .../model/factories/OptionsFactory.test.ts | 6 +- .../model/factories/OverviewFactory.test.ts | 72 +++++++++++++++---- .../unit/model/factories/ValidComparison.json | 8 ++- .../unit/model/factories/ValidOverview.json | 24 +++++-- 8 files changed, 150 insertions(+), 70 deletions(-) diff --git a/report-viewer/tests/unit/components/comparisonTable/ComparisonTable.test.ts b/report-viewer/tests/unit/components/comparisonTable/ComparisonTable.test.ts index 2866e79a4f..c0970e35f1 100644 --- a/report-viewer/tests/unit/components/comparisonTable/ComparisonTable.test.ts +++ b/report-viewer/tests/unit/components/comparisonTable/ComparisonTable.test.ts @@ -3,7 +3,7 @@ import { flushPromises, mount } from '@vue/test-utils' import { describe, it, vi, expect } from 'vitest' import { createTestingPinia } from '@pinia/testing' import { store } from '@/stores/store' -import { MetricType } from '@/model/MetricType.ts' +import { MetricJsonIdentifier } from '@/model/MetricType.ts' import { router } from '@/router' import OptionsSelector from '@/components/optionsSelectors/OptionsSelectorComponent.vue' import OptionComponent from '@/components/optionsSelectors/OptionComponent.vue' @@ -19,8 +19,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'A', secondSubmissionId: 'B', similarities: { - [MetricType.AVERAGE]: 1, - [MetricType.MAXIMUM]: 0.5 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 1, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.5 }, clusterIndex: -1 }, @@ -30,8 +30,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'C', secondSubmissionId: 'D', similarities: { - [MetricType.AVERAGE]: 0.5, - [MetricType.MAXIMUM]: 1 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.5, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 1 }, clusterIndex: -1 } @@ -68,8 +68,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'A', secondSubmissionId: 'B', similarities: { - [MetricType.AVERAGE]: 0.3, - [MetricType.MAXIMUM]: 0.5 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.3, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.5 }, clusterIndex: -1 }, @@ -79,8 +79,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'C', secondSubmissionId: 'D', similarities: { - [MetricType.AVERAGE]: 0.5, - [MetricType.MAXIMUM]: 1 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.5, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 1 }, clusterIndex: -1 }, @@ -90,8 +90,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'E', secondSubmissionId: 'F', similarities: { - [MetricType.AVERAGE]: 0.3, - [MetricType.MAXIMUM]: 0.1 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.3, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.1 }, clusterIndex: -1 }, @@ -101,8 +101,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'H', secondSubmissionId: 'G', similarities: { - [MetricType.AVERAGE]: 0.9, - [MetricType.MAXIMUM]: 0.2 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.9, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.2 }, clusterIndex: -1 } @@ -152,8 +152,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'A', secondSubmissionId: 'B', similarities: { - [MetricType.AVERAGE]: 0.3, - [MetricType.MAXIMUM]: 0.5 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.3, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.5 }, clusterIndex: -1 }, @@ -163,8 +163,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'C', secondSubmissionId: 'D', similarities: { - [MetricType.AVERAGE]: 0.4, - [MetricType.MAXIMUM]: 1 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.4, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 1 }, clusterIndex: -1 }, @@ -174,8 +174,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'E', secondSubmissionId: 'F', similarities: { - [MetricType.AVERAGE]: 0.3, - [MetricType.MAXIMUM]: 0.1 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.3, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.1 }, clusterIndex: -1 }, @@ -185,8 +185,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'H', secondSubmissionId: 'G', similarities: { - [MetricType.AVERAGE]: 0.9, - [MetricType.MAXIMUM]: 0.2 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.9, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.2 }, clusterIndex: -1 } @@ -249,8 +249,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'A', secondSubmissionId: 'B', similarities: { - [MetricType.AVERAGE]: 0.3, - [MetricType.MAXIMUM]: 0.5 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.3, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.5 }, clusterIndex: 0 }, @@ -260,8 +260,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'C', secondSubmissionId: 'D', similarities: { - [MetricType.AVERAGE]: 0.5, - [MetricType.MAXIMUM]: 1 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.5, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 1 }, clusterIndex: 1 }, @@ -271,8 +271,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'E', secondSubmissionId: 'F', similarities: { - [MetricType.AVERAGE]: 0.3, - [MetricType.MAXIMUM]: 0.1 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.3, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.1 }, clusterIndex: 2 }, @@ -282,8 +282,8 @@ describe('ComparisonTable', async () => { firstSubmissionId: 'H', secondSubmissionId: 'G', similarities: { - [MetricType.AVERAGE]: 0.9, - [MetricType.MAXIMUM]: 0.2 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.9, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.2 }, clusterIndex: -1 } @@ -329,7 +329,7 @@ describe('ComparisonTable', async () => { expect(displayedComparisonsMaxSorted[2].firstSubmissionId).toBe('H') expect(displayedComparisonsMaxSorted[3].firstSubmissionId).toBe('E') - await metricOptions[2].trigger('click') + await metricOptions[7].trigger('click') await flushPromises() // Test sorting by cluster diff --git a/report-viewer/tests/unit/components/comparisonTable/ComparisonTableFilter.test.ts b/report-viewer/tests/unit/components/comparisonTable/ComparisonTableFilter.test.ts index 2b11ea6a5d..c6752cb13c 100644 --- a/report-viewer/tests/unit/components/comparisonTable/ComparisonTableFilter.test.ts +++ b/report-viewer/tests/unit/components/comparisonTable/ComparisonTableFilter.test.ts @@ -3,7 +3,7 @@ import { flushPromises, mount } from '@vue/test-utils' import { describe, it, vi, expect } from 'vitest' import { createTestingPinia } from '@pinia/testing' import { store } from '@/stores/store' -import { MetricType } from '@/model/MetricType.ts' +import { MetricJsonIdentifier } from '@/model/MetricType.ts' import ButtonComponent from '@/components/ButtonComponent.vue' import OptionsSelector from '@/components/optionsSelectors/OptionsSelectorComponent.vue' import OptionComponent from '@/components/optionsSelectors/OptionComponent.vue' @@ -41,21 +41,31 @@ describe('ComparisonTableFilter', async () => { expect(wrapper.text()).toContain('Cluster') const options = wrapper.getComponent(OptionsSelector).findAllComponents(OptionComponent) - expectHighlighting(0) await options[1].trigger('click') - expect(store().uiState.comparisonTableSortingMetric).toBe(MetricType.MAXIMUM) + expect(store().uiState.comparisonTableSortingMetric).toBe( + MetricJsonIdentifier.MAXIMUM_SIMILARITY + ) expect(store().uiState.comparisonTableClusterSorting).toBeFalsy() expectHighlighting(1) - await options[2].trigger('click') - expect(store().uiState.comparisonTableSortingMetric).toBe(MetricType.AVERAGE) + await options[4].trigger('click') + expect(store().uiState.comparisonTableSortingMetric).toBe(MetricJsonIdentifier.SYMMETRIC) + expect(store().uiState.comparisonTableClusterSorting).toBeFalsy() + expectHighlighting(4) + + await options[7].trigger('click') + expect(store().uiState.comparisonTableSortingMetric).toBe( + MetricJsonIdentifier.AVERAGE_SIMILARITY + ) expect(store().uiState.comparisonTableClusterSorting).toBeTruthy() - expectHighlighting(2) + expectHighlighting(7) await options[0].trigger('click') - expect(store().uiState.comparisonTableSortingMetric).toBe(MetricType.AVERAGE) + expect(store().uiState.comparisonTableSortingMetric).toBe( + MetricJsonIdentifier.AVERAGE_SIMILARITY + ) expect(store().uiState.comparisonTableClusterSorting).toBeFalsy() expectHighlighting(0) diff --git a/report-viewer/tests/unit/components/optionsSelectors/MetricSelector.test.ts b/report-viewer/tests/unit/components/optionsSelectors/MetricSelector.test.ts index 304100bf13..2bf1437191 100644 --- a/report-viewer/tests/unit/components/optionsSelectors/MetricSelector.test.ts +++ b/report-viewer/tests/unit/components/optionsSelectors/MetricSelector.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { mount } from '@vue/test-utils' import MetricSelector from '@/components/optionsSelectors/MetricSelector.vue' -import { MetricType } from '@/model/MetricType' +import { MetricJsonIdentifier, MetricTypes } from '@/model/MetricType' describe('OptionSelectorComponent', () => { it('renders all options', async () => { @@ -12,20 +12,22 @@ describe('OptionSelectorComponent', () => { }) expect(wrapper.text()).toContain('Test:') - expect(wrapper.text()).toContain('Average Similarity') - expect(wrapper.text()).toContain('Maximum Similarity') + for (const metric of MetricTypes.METRIC_LIST) { + expect(wrapper.text()).toContain(metric.longName) + } }) it('renders given metrics only', async () => { const wrapper = mount(MetricSelector, { props: { title: 'Test:', - metrics: [MetricType.AVERAGE] + metrics: [MetricJsonIdentifier.AVERAGE_SIMILARITY, MetricJsonIdentifier.MINIMUM_SIMILARITY] } }) expect(wrapper.text()).toContain('Test:') expect(wrapper.text()).toContain('Average Similarity') + expect(wrapper.text()).toContain('Minimum Similarity') expect(wrapper.text()).not.toContain('Maximum Similarity') }) @@ -40,6 +42,8 @@ describe('OptionSelectorComponent', () => { expect(wrapper.emitted('selectionChanged')).toBeTruthy() expect(wrapper.emitted('selectionChanged')?.length).toBe(1) - expect(wrapper.emitted('selectionChanged')?.[0]).toEqual([MetricType.MAXIMUM]) + expect(wrapper.emitted('selectionChanged')?.[0]).toEqual([ + MetricJsonIdentifier.MAXIMUM_SIMILARITY + ]) }) }) diff --git a/report-viewer/tests/unit/model/factories/ComparisonFactory.test.ts b/report-viewer/tests/unit/model/factories/ComparisonFactory.test.ts index a918f43edb..24d6ce8e7e 100644 --- a/report-viewer/tests/unit/model/factories/ComparisonFactory.test.ts +++ b/report-viewer/tests/unit/model/factories/ComparisonFactory.test.ts @@ -2,7 +2,7 @@ import { it, beforeEach, describe, expect } from 'vitest' import validNew from './ValidComparison.json' import { ComparisonFactory } from '@/model/factories/ComparisonFactory' import { store } from '@/stores/store' -import { MetricType } from '@/model/MetricType' +import { MetricJsonIdentifier } from '@/model/MetricType' import { setActivePinia, createPinia } from 'pinia' describe('Test JSON to Comparison', () => { @@ -59,8 +59,14 @@ describe('Test JSON to Comparison', () => { expect(result).toBeDefined() expect(result.firstSubmissionId).toBe('root1') expect(result.secondSubmissionId).toBe('root2') - expect(result.similarities[MetricType.AVERAGE]).toBe(0.45) - expect(result.similarities[MetricType.MAXIMUM]).toBe(0.5) + expect(result.similarities[MetricJsonIdentifier.AVERAGE_SIMILARITY]).toBe(0.45) + expect(result.similarities[MetricJsonIdentifier.MAXIMUM_SIMILARITY]).toBe(0.5) + expect(result.similarities[MetricJsonIdentifier.MINIMUM_SIMILARITY]).toBe(0.4) + expect(result.similarities[MetricJsonIdentifier.INTERSECTION]).toBe(229) + expect(result.similarities[MetricJsonIdentifier.SYMMETRIC]).toBe(0.5) + expect(result.similarities[MetricJsonIdentifier.LONGEST_MATCH]).toBe(139) + expect(result.similarities[MetricJsonIdentifier.OVERALL]).toBe(916) + expect(result.filesOfFirstSubmission).toBeDefined() expect(result.filesOfSecondSubmission).toBeDefined() expect(result.allMatches.length).toBe(4) diff --git a/report-viewer/tests/unit/model/factories/OptionsFactory.test.ts b/report-viewer/tests/unit/model/factories/OptionsFactory.test.ts index 5cbc82bee9..4041c99235 100644 --- a/report-viewer/tests/unit/model/factories/OptionsFactory.test.ts +++ b/report-viewer/tests/unit/model/factories/OptionsFactory.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, it, expect } from 'vitest' import { OptionsFactory } from '@/model/factories/OptionsFactory' import { ParserLanguage } from '@/model/Language' -import { MetricType } from '@/model/MetricType' +import { MetricTypes } from '@/model/MetricType' import validOptions from './ValidOptions.json' import { setActivePinia, createPinia } from 'pinia' import { store } from '@/stores/store' @@ -25,12 +25,12 @@ describe('Test JSON to Options', async () => { subDirectoryName: 'src/', fileSuffixes: ['.java', '.JAVA'], exclusionFileName: 'ex.txt', - similarityMetric: MetricType.AVERAGE, + similarityMetric: MetricTypes.AVERAGE_SIMILARITY, similarityThreshold: 0.0, maxNumberComparisons: 500, clusterOptions: { enabled: true, - similarityMetric: MetricType.AVERAGE, + similarityMetric: MetricTypes.AVERAGE_SIMILARITY, spectralBandwidth: 20.0, spectralGaussianProcessVariance: 0.0025000000000000005, spectralMinRuns: 5, diff --git a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts index d5f9fb21dd..8871147541 100644 --- a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts +++ b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts @@ -1,6 +1,6 @@ import { beforeAll, describe, expect, it, vi, beforeEach } from 'vitest' import { OverviewFactory } from '@/model/factories/OverviewFactory' -import { MetricType } from '@/model/MetricType' +import { MetricJsonIdentifier } from '@/model/MetricType' import { Distribution } from '@/model/Distribution' import { ParserLanguage } from '@/model/Language' import validNew from './ValidOverview.json' @@ -34,8 +34,13 @@ describe('Test JSON to Overview', () => { firstSubmissionId: 'A', secondSubmissionId: 'C', similarities: { - [MetricType.AVERAGE]: 0.9960435212660732, - [MetricType.MAXIMUM]: 0.9960435212660732 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.9960435212660732, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.9960435212660732, + [MetricJsonIdentifier.MINIMUM_SIMILARITY]: 0.99, + [MetricJsonIdentifier.SYMMETRIC]: 0.98, + [MetricJsonIdentifier.LONGEST_MATCH]: 13, + [MetricJsonIdentifier.INTERSECTION]: 32, + [MetricJsonIdentifier.OVERALL]: 100 }, sortingPlace: 0, id: 1, @@ -45,8 +50,13 @@ describe('Test JSON to Overview', () => { firstSubmissionId: 'D', secondSubmissionId: 'A', similarities: { - [MetricType.AVERAGE]: 0.751044776119403, - [MetricType.MAXIMUM]: 0.947289156626506 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.751044776119403, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.947289156626506, + [MetricJsonIdentifier.MINIMUM_SIMILARITY]: 0.5, + [MetricJsonIdentifier.SYMMETRIC]: 0.8, + [MetricJsonIdentifier.LONGEST_MATCH]: 4, + [MetricJsonIdentifier.INTERSECTION]: 12, + [MetricJsonIdentifier.OVERALL]: 133 }, sortingPlace: 1, id: 2, @@ -56,8 +66,13 @@ describe('Test JSON to Overview', () => { firstSubmissionId: 'D', secondSubmissionId: 'C', similarities: { - [MetricType.AVERAGE]: 0.751044776119403, - [MetricType.MAXIMUM]: 0.947289156626506 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.751044776119403, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.947289156626506, + [MetricJsonIdentifier.MINIMUM_SIMILARITY]: 0.46, + [MetricJsonIdentifier.SYMMETRIC]: 0.78, + [MetricJsonIdentifier.LONGEST_MATCH]: 12, + [MetricJsonIdentifier.INTERSECTION]: 12, + [MetricJsonIdentifier.OVERALL]: 98 }, sortingPlace: 2, id: 3, @@ -67,8 +82,13 @@ describe('Test JSON to Overview', () => { firstSubmissionId: 'B', secondSubmissionId: 'D', similarities: { - [MetricType.AVERAGE]: 0.28322981366459626, - [MetricType.MAXIMUM]: 0.8085106382978723 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.28322981366459626, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.8085106382978723, + [MetricJsonIdentifier.MINIMUM_SIMILARITY]: 0.1, + [MetricJsonIdentifier.SYMMETRIC]: 0.456, + [MetricJsonIdentifier.LONGEST_MATCH]: 5, + [MetricJsonIdentifier.INTERSECTION]: 6, + [MetricJsonIdentifier.OVERALL]: 32 }, sortingPlace: 3, id: 4, @@ -78,8 +98,13 @@ describe('Test JSON to Overview', () => { firstSubmissionId: 'B', secondSubmissionId: 'A', similarities: { - [MetricType.AVERAGE]: 0.2378472222222222, - [MetricType.MAXIMUM]: 0.9716312056737588 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.2378472222222222, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.9716312056737588, + [MetricJsonIdentifier.MINIMUM_SIMILARITY]: 0.05, + [MetricJsonIdentifier.SYMMETRIC]: 0.23, + [MetricJsonIdentifier.LONGEST_MATCH]: 7, + [MetricJsonIdentifier.INTERSECTION]: 9, + [MetricJsonIdentifier.OVERALL]: 34 }, sortingPlace: 4, id: 5, @@ -89,8 +114,13 @@ describe('Test JSON to Overview', () => { firstSubmissionId: 'B', secondSubmissionId: 'C', similarities: { - [MetricType.AVERAGE]: 0.2378472222222222, - [MetricType.MAXIMUM]: 0.9716312056737588 + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: 0.2378472222222222, + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: 0.9716312056737588, + [MetricJsonIdentifier.MINIMUM_SIMILARITY]: 0.06, + [MetricJsonIdentifier.SYMMETRIC]: 0.235, + [MetricJsonIdentifier.LONGEST_MATCH]: 3, + [MetricJsonIdentifier.INTERSECTION]: 6, + [MetricJsonIdentifier.OVERALL]: 134 }, sortingPlace: 5, id: 6, @@ -98,13 +128,25 @@ describe('Test JSON to Overview', () => { } ], _distributions: { - [MetricType.MAXIMUM]: new Distribution([ + [MetricJsonIdentifier.MAXIMUM_SIMILARITY]: new Distribution([ 1, 0, 2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]), - [MetricType.AVERAGE]: new Distribution([ + [MetricJsonIdentifier.AVERAGE_SIMILARITY]: new Distribution([ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ]), + [MetricJsonIdentifier.MINIMUM_SIMILARITY]: new Distribution([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 2, 3 + ]), + [MetricJsonIdentifier.SYMMETRIC]: new Distribution([ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/report-viewer/tests/unit/model/factories/ValidComparison.json b/report-viewer/tests/unit/model/factories/ValidComparison.json index 2698402a20..5e3ac80647 100644 --- a/report-viewer/tests/unit/model/factories/ValidComparison.json +++ b/report-viewer/tests/unit/model/factories/ValidComparison.json @@ -3,7 +3,13 @@ "id2": "root2", "similarities": { "AVG": 0.45, - "MAX": 0.5 + "MAX": 0.5, + "MIN": 0.4, + "LONGEST_MATCH": 139, + "INTERSECTION": 229, + "SYMMETRIC": 0.5, + "OVERALL": 916 + }, "matches": [ { diff --git a/report-viewer/tests/unit/model/factories/ValidOverview.json b/report-viewer/tests/unit/model/factories/ValidOverview.json index 1ddfd238ef..5b0843d22a 100644 --- a/report-viewer/tests/unit/model/factories/ValidOverview.json +++ b/report-viewer/tests/unit/model/factories/ValidOverview.json @@ -28,38 +28,50 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ], + "MIN": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2, 3 + ], + "SYMMETRIC": [ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 ] }, "top_comparisons": [ { "first_submission": "A", "second_submission": "C", - "similarities": { "AVG": 0.9960435212660732, "MAX": 0.9960435212660732 } + "similarities": { "AVG": 0.9960435212660732, "MAX": 0.9960435212660732, "MIN": 0.99, "SYMMETRIC": 0.98, "LONGEST_MATCH": 13.0, "INTERSECTION": 32.0, "OVERALL": 100.0 } }, { "first_submission": "D", "second_submission": "A", - "similarities": { "AVG": 0.751044776119403, "MAX": 0.947289156626506 } + "similarities": { "AVG": 0.751044776119403, "MAX": 0.947289156626506, "MIN": 0.5, "SYMMETRIC": 0.8, "LONGEST_MATCH": 4.0, "INTERSECTION": 12.0, "OVERALL": 133.0 } }, { "first_submission": "D", "second_submission": "C", - "similarities": { "AVG": 0.751044776119403, "MAX": 0.947289156626506 } + "similarities": { "AVG": 0.751044776119403, "MAX": 0.947289156626506, "MIN": 0.46, "SYMMETRIC": 0.78, "LONGEST_MATCH": 12.0, "INTERSECTION": 12.0, "OVERALL": 98.0 } }, { "first_submission": "B", "second_submission": "D", - "similarities": { "AVG": 0.28322981366459626, "MAX": 0.8085106382978723 } + "similarities": { "AVG": 0.28322981366459626, "MAX": 0.8085106382978723, "MIN": 0.1, "SYMMETRIC": 0.456, "LONGEST_MATCH": 5.0, "INTERSECTION": 6.0, "OVERALL": 32.0 } }, { "first_submission": "B", "second_submission": "A", - "similarities": { "AVG": 0.2378472222222222, "MAX": 0.9716312056737588 } + "similarities": { "AVG": 0.2378472222222222, "MAX": 0.9716312056737588, "MIN": 0.05, "SYMMETRIC": 0.23, "LONGEST_MATCH": 7.0, "INTERSECTION": 9.0, "OVERALL": 34.0 } }, { "first_submission": "B", "second_submission": "C", - "similarities": { "AVG": 0.2378472222222222, "MAX": 0.9716312056737588 } + "similarities": { "AVG": 0.2378472222222222, "MAX": 0.9716312056737588, "MIN": 0.06, "SYMMETRIC": 0.235, "LONGEST_MATCH": 3.0, "INTERSECTION": 6.0, "OVERALL": 134.0 } } ], "clusters": [