Skip to content
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

Add effect test and some effect test data #40222

Merged
merged 1 commit into from
May 6, 2020

Conversation

wapcaplet
Copy link
Contributor

@wapcaplet wapcaplet commented May 6, 2020

Summary

SUMMARY: Infrastructure "Add tests for the effect class"

Purpose of change

To have more test coverage of effects, including several major attributes documented in EFFECT_JSON.md

Describe the solution

Add new test cases focused on effect class functions, including:

  • High-level: decay (invoked by Creature::process_effects)
  • Duration: get_duration, set_duration, get_max_duration
  • Permanence: is_permanent, pause_effect, unpause_effect
  • Display: disp_name, get_speed_name, disp_short_desc
  • Intensity: get_intensity, set_intensity, mod_intensity
  • Body parts: get_bp, set_bp
  • Modifiers: get_mod, get_amount

Example behaviors exercised:

  • simple class initialization test
  • minimum / maximum intensity level
  • intensity tracks duration for duration-related effects
  • decay reduces duration until the effect is removed
  • displayed names can vary based on intensity
  • pause and unpause effect permanence
  • switch grab effect body part back and forth

Some related JSON attributes:

  • "name": [ "A", "B", "C"] - multiple intensity names
  • "speed_name": "@-name" - as shown in the @ menu
  • "base_mods": [ ... ] - fixed mod to stats, healing, etc.
  • "scaling_mods": [ ... ] - intensity-based mods to stats, etc.
  • "int_dur_factor": time - for duration-based intensity

Includes some JSON test data to use for data-dependent checks.

Describe alternatives you've considered

I didn't get done all that I wanted, but I figure it never hurts to leave a few gimme TODOs for future contributors.

Testing

tests/cata_test [effect]

Additional context

Was originally part of #40064 but that one was getting hairy, so I pulled this part out, to be part one of several standalone PRs.

Includes test cases focused on `effect` class functions, including:

- High-level: decay (invoked by Creature::process_effects)
- Duration: get_duration, set_duration, get_max_duration
- Permanence: is_permanent, pause_effect, unpause_effect
- Display: disp_name, get_speed_name, disp_short_desc
- Intensity: get_intensity, set_intensity, mod_intensity
- Body parts: get_bp, set_bp
- Modifiers: get_mod, get_amount

Example behaviors exercised:

- simple class initialization test
- minimum / maximum intensity level
- intensity tracks duration for duration-related effects
- decay reduces duration until the effect is removed
- displayed names can vary based on intensity
- pause and unpause effect permanence
- switch grab effect body part back and forth

Some related JSON attributes:

- "name": [ "A", "B", "C"] // multiple intensity names
- "speed_name": "@-name"   // as shown in the @ menu
- "base_mods": [ ... ]     // fixed mod to stats, healing, etc.
- "scaling_mods": [ ... ]  // intensity-based mods to stats, etc.
- "int_dur_factor": time   // for duration-based intensity

Includes some JSON test data to use for data-dependent checks.
@kevingranade kevingranade merged commit c6bfe18 into CleverRaven:master May 6, 2020
@wapcaplet wapcaplet deleted the fx-base branch May 6, 2020 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants