Skip to content

Actualise test for using except on provider with fallback #2660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

IlyaMuravjov
Copy link
Collaborator

Description

Fixes #2659 by updating tests, that were verifying outdated semantic of except.

Previously provider.except(filter) wasn't recursive and was removing all the fallbacks.

Semantic of except was updated to solve the issues with using .except { it is ObjectValueProvider } on the following provider causing AbstractsObjectValueProvider and BuilderObjectValueProvider to be remoed (since they are fallbacks) and ObjectValueProvider itself not to be removed (since it's not on the top level, i.e. it's a part of ValueProvider.Combined that is nested into ValueProvider.Fallback that is nested into another ValueProvider.Combined).

ValueProvider.of(listOf(
    BooleanValueProvider,
    IntegerValueProvider,
    FloatValueProvider,
    StringValueProvider,
    NumberValueProvider,
    anyObjectValueProvider(idGenerator),
    ArrayValueProvider(idGenerator),
    EnumValueProvider(idGenerator),
    ListSetValueProvider(idGenerator),
    MapValueProvider(idGenerator),
    IteratorValueProvider(idGenerator),
    EmptyCollectionValueProvider(idGenerator),
    DateValueProvider(idGenerator),
    (ObjectValueProvider(idGenerator)
        with ArrayValueProvider(idGenerator)
        with EnumValueProvider(idGenerator)
        with ListSetValueProvider(idGenerator)
        with MapValueProvider(idGenerator)
        with IteratorValueProvider(idGenerator)
        with EmptyCollectionValueProvider(idGenerator)
        with DateValueProvider(idGenerator))
            .withFallback(
                AbstractsObjectValueProvider(idGenerator)
                        with BuilderObjectValueProvider(idGenerator)
            ),
    VoidValueProvider,
    NullValueProvider,
))

How to test

Automated tests

The proposed changes are verified with tests:
utbot-fuzzing/src/test/kotlin/org/utbot/fuzzing/ProvidersTest.kt

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@IlyaMuravjov IlyaMuravjov added comp-fuzzing Issue is related to the fuzzing ctg-bug-fix PR is fixing a bug labels Oct 16, 2023
@IlyaMuravjov IlyaMuravjov merged commit bfc2fde into main Oct 16, 2023
@IlyaMuravjov IlyaMuravjov deleted the ilya_m/update-provider-except-test branch October 16, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-fuzzing Issue is related to the fuzzing ctg-bug-fix PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProvidersTest.test fallback unwrapping from providers() fails in :utbot-fuzzing:test
2 participants