Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Sound & Video
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook

Mockingbird

Tutorials

  • WritingMockTestsWithMockingbird

Guides

  • Mockingbird

Symbols

  • MockDefinitionGroup
  • MockDefinition
  • MockEvaluate
  • MockEvaluateReap
  • MockPropertyValuePatternTest
  • MockPropertyValueQ
  • MockSow
Wolfram`Mockingbird`
MockDefinition
​
MockDefinition[lhs:=rhs]
represents a delayed definition of the pattern
lhs
for use during mock evaluation.
​
MockDefinition[lhs=rhs]
​ represents an immediate definition of the pattern
lhs
.
​
MockDefinition[f/:lhs:=rhs]
​ represents a delayed definition associated with the symbol
f
.
​
MockDefinition[f/:lhs=rhs]
​ represents an immediate definition associated with the symbol
f
.
Details

Examples  
(7)
Basic Examples  
(1)
In[1]:=
Needs["Wolfram`Mockingbird`"]
Create a mock definition for the function
f
:
In[2]:=
def=
MockDefinition
[f[x_]:=Expand[(x/2)^3]]
Out[2]=
MockDefinitionf[x_]:=Expand
3
x
2

Use the definition with
MockEvaluate
:
In[3]:=
MockEvaluate
[def,f[a+b]]
Out[3]=
3
a
8
+
3
2
a
b
8
+
3a
2
b
8
+
3
b
8
The mocked definition is used before any definitions already in the session:
In[4]:=
f[x_]:=Expand[x^2]​​f[a+b]
Out[4]=
2
a
+2ab+
2
b
In[5]:=
MockEvaluate
[def,f[a+b]]
Out[5]=
3
a
8
+
3
2
a
b
8
+
3a
2
b
8
+
3
b
8
Scope  
(1)

Options  
(2)

Properties & Relations  
(1)

Possible Issues  
(2)

SeeAlso
MockEvaluate
 
▪
MockDefinitionGroup
 
▪
SetDelayed
 
▪
Set
 
▪
TagSetDelayed
 
▪
TagSet
TechNotes
▪
Writing Mock Tests with Mockingbird
RelatedGuides
▪
Mockingbird
RelatedLinks
▪
Villegas-Gayley technique
▪
Writing Mock Tests with Mockingbird

© 2023 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com