संशोधन इतिहास (केवल पहला संस्करण, 17 Nov 2026 को प्रकाशित)
- पहला प्रकाशन
सभी tests pass हो रहे हों, तब भी यह ज़रूरी नहीं कि वे tests code की गलती पकड़ पाएँ। जो test boundary values check नहीं करता, वह >= को > में बदल देने पर भी pass हो जाता है।
AdaMutant इसी बात को जाँचने का tool है। यह Ada और SPARK के source में automatically छोटे बदलाव डालता है और check करता है कि tests या GNATprove के proofs उन बदलावों को detect कर पाते हैं या नहीं। KomuraSoft इसे Apache License 2.0 के तहत publish करता है।1
इस लेख में AdaMutant क्या करता है, यह इसके साथ आने वाले samples को असल में चलाकर मिले results के साथ बताया गया है। Environment था Ubuntu 24.04, GNAT 14.2.0 और 4 cores, और AdaMutant का version 0.1.0 था। Alire crate के description में लिखा है कि यह Linux, macOS और Windows पर चलता है, लेकिन इस लेख में इसे सिर्फ़ Linux पर try किया गया है।2
Mutation testing क्या है
Mutation testing में production code को थोड़ा-सा बदलकर उसके versions (mutants) automatically बनाए जाते हैं, फिर tests चलाकर देखा जाता है कि वे fail होते हैं या नहीं। अगर test fail होता है, तो इसका मतलब है कि test उस बदलाव को पकड़ पाया। अगर सब pass हो जाते हैं, तो मतलब नहीं पकड़ पाया। इसके पीछे के idea को mutation testing से अपने tests को test करना में detail में लिखा है।
.NET में Stryker.NET नाम का tool है। AdaMutant उसी idea को Ada और SPARK में लाता है।
flowchart TB
accTitle: Mutation testing का flow
accDescr: Original code में mutant डालकर build करना और tests चलाना, test fail हो तो बदलाव detect हुआ माना जाता है, और सब pass हो जाएँ तो detect नहीं हुआ, यह flow दिखाता है।
A["Original code में छोटा बदलाव डालें"] --> B["Build करके tests चलाएँ"]
B -->|"Test fail होता है"| C["Killed: बदलाव detect हुआ"]
B -->|"सब pass होते हैं"| D["Survived: बदलाव detect नहीं हुआ"]
चित्र 1: जिस mutant पर test fail होता है, उसे detect हुआ माना जाता है।
Diagram में solid line हमेशा लागू रहने वाला relation दिखाती है और dashed line conditional relation दिखाती है (शर्तें detail page पर हर relation के explanation में दी गई हैं)। Relations की पूरी list (कुल 4, evidence और certainty सहित) तथा मुख्य concepts की definitions knowledge map की detail page पर संकलित हैं (जापानी में)। Data: JSON-LD / Turtle
AdaMutant के features
README में बताए गए features ये हैं।1
- Ada 2022 तक का lexer built-in है, इसलिए libadalang जैसी कोई extra dependency नहीं चाहिए
- Test failure के अलावा GNATprove के proof failure से भी mutants detect कर सकता है
- Mutants को एक साथ एक ही build में compile करता है, और test run के समय switch करता है कि कौन-सा mutant active हो
- Project की कई copies (sandboxes) बनाकर parallel में चलाता है, और जो test time limit में ख़त्म न हो उसे बीच में रोक देता है
- Git revision देकर सिर्फ़ बदली हुई lines के mutants check किए जा सकते हैं
- Results को console table, अपने-आप में खुलने वाली HTML और JSON में देता है
यह 10 तरह के mutants बनाता है: arithmetic operators (+ और - की अदला-बदली वगैरह), comparison operators (< को <= करना वगैरह), logical operators, unary operators, boolean values, membership tests (in और not in), conditional expressions (condition को True या False कर देना), statement deletion, numeric literals और string literals।
flowchart TB
accTitle: AdaMutant के mutants detect करने के 2 तरीके
accDescr: AdaMutant पहले mutant पर tests चलाता है, test fail हो तो detect माना जाता है, जिन mutants पर tests pass होते हैं उन्हें proof पर भेजता है, proof fail हो तो detect माना जाता है, और दोनों pass हो जाएँ तो mutant survive करता है, यह दिखाता है।
A["Mutant"] --> B["Tests चलाएँ"]
B -->|"Fail"| C["Killed"]
B -->|"Pass"| D["GNATprove से prove करें"]
D -->|"Fail"| C
D -->|"Pass"| E["Survived"]
चित्र 2: Tests और proof दोनों set हों, तो सिर्फ़ वही mutants proof पर जाते हैं जिन पर tests pass हुए।
Download और build
Ada 2022 support करने वाला GNAT और GPRbuild चाहिए। Proof से detect करना हो, तो GNATprove भी चाहिए।
अगर आप Alire से Ada project शुरू करना use करते हैं, तो index से crate लेकर build करें। Crate का नाम mutant है और बनने वाले executable का नाम adamutant है।2
alr get mutant
cd mutant_0.1.0_*
alr build
हमारे environment में fetch से build तक सब इन्हीं steps से हो गया। Build में 43 seconds लगे।
Repository clone करके make से भी build कर सकते हैं।
git clone https://github.com/gomurin0428/AdaMutant
cd AdaMutant
make build
दोनों तरीकों से bin/adamutant बनता है। आगे यह माना गया है कि यह executable PATH में है।
flowchart TB
accTitle: AdaMutant पाने के 2 तरीके
accDescr: Alire से crate लेकर build करने का तरीका और repository clone करके make से build करने का तरीका है, और दोनों से adamutant executable बनता है, यह दिखाता है।
A["Alire से लें: alr get mutant"] --> C["alr build"]
B["Repository लें: git clone"] --> D["make build"]
C --> E["Executable bin/adamutant"]
D --> E
चित्र 3: दोनों तरीकों से वही executable बनता है।
Sample चलाना
Repository का examples/calculator एक sample है, जिसके tests जानबूझकर boundary values check नहीं करते। इसकी configuration file adamutant.toml यह है।
mutate = ["src/**/*.adb", "src/**/*.ads"]
build = "gprbuild -p -q -P calculator_tests.gpr"
test = '"bin/test_calculator"'
concurrency = 2
sandbox_exclude = [".git", "obj", "bin"]
[thresholds]
high = 80
low = 60
break = 50
mutate वे files हैं जिनमें बदलाव डाले जाते हैं, build build command है, और test test command है। अगर test command 0 के अलावा कोई exit code लौटाता है, तो वह mutant detect हुआ माना जाता है।
इस folder में adamutant run चलाने पर output का आखिरी हिस्सा यह है।
File | Score % | Killed | Timeout | Survived | No cov | Compile | Ignored
---------------------------------------------------------------------------------------
All files | 77.50 | 29 | 2 | 9 | 0 | 0 | 0
src/calculator.adb | 75.00 | 25 | 2 | 9 | 0 | 0 | 0
src/calculator.ads | 100.00 | 4 | 0 | 0 | 0 | 0 | 0
Mutation score: 77.50% (31 detected, 9 undetected, 0 compile errors, 0 ignored) in 12 s
40 mutants में से 29 पर tests fail हुए और वे detect हो गए, 2 timeout हुए, और 9 survive कर गए। कुल 12 seconds लगे।
flowchart TB
accTitle: calculator sample के 40 mutants के results
accDescr: 40 mutants में से 29 tests fail होने से detect हुए, 2 timeout होकर detect माने गए, और 9 survive कर गए, यह दिखाता है।
A["40 mutants"] --> B["Detected: 31"]
A --> C["Undetected: 9 (Survived)"]
B --> D["29: test fail हुआ (Killed)"]
B --> E["2: time out हुआ (Timeout)"]
चित्र 4: 31 mutants detect हुए और 9 detect नहीं हो पाए।
Timeout हुए 2 mutants loop के अंदर I := I + 1; को बदलने वाले हैं। एक में यह statement हटा दिया गया और दूसरे में I + 1 को I + 0 कर दिया गया। दोनों में loop कभी ख़त्म नहीं होता। AdaMutant बिना बदलाव वाले test run के समय के आधार पर limit तय करता है, उसके बाद test रोक देता है और mutant को detect हुआ गिनता है।
Reports .adamutant/reports में बनती हैं। HTML report (mutation-report.html) में source lines पर colour लगता है। नीचे की image इस sample की report का एक हिस्सा है। Green lines पर कोई undetected mutant नहीं है, सिर्फ़ detect हुए mutants हैं। Red lines वे हैं जिन पर कोई survive हुआ mutant है। किसी line पर click करने से उस line के mutants की list खुलती है।

Survive हुए mutants को पढ़ना
Survive हुए 9 में से 6 mutants Grade function के हैं, जो score से grade लौटाता है।
function Grade (Score : Natural) return String is
begin
if Score >= 80 then
return "A";
elsif Score >= 60 then
return "B";
end if;
return "C";
end Grade;
Tests सिर्फ़ दो बातें check करते हैं: Grade (95) का "A" होना और Grade (10) का "C" होना। 80 या 60 की boundary, और "B" वाला case check नहीं होता। इसलिए >= को > करने पर भी, या 80 को 81 करने पर भी, tests pass हो जाते हैं।
Boundaries check करने वाले 4 tests जोड़े।
Check (Grade (80) = "A", "Grade A boundary");
Check (Grade (79) = "B", "Grade B upper");
Check (Grade (60) = "B", "Grade B boundary");
Check (Grade (59) = "C", "Grade C upper");
दोबारा चलाने पर score 92.50% हो गया और survive करने वाले 3 mutants रह गए। ये 3 अलग-अलग तरह के हैं।
पहला Max में if A > B then को if A >= B then करने वाला mutant है।
function Max (A, B : Integer) return Integer is
begin
if A > B then
return A;
else
return B;
end if;
end Max;
जब A और B बराबर हों, original code B लौटाता है और mutant A लौटाता है। Value वही है। कोई भी test लिखें, इन दोनों में फ़र्क नहीं किया जा सकता। ऐसा mutant, जो original code जैसा ही behave करे, equivalent mutant कहलाता है।
बाकी 2 mutants Clamp के comparisons के हैं।
function Clamp (X, Low, High : Integer) return Integer is
begin
if X < Low then
return Low;
elsif X > High then
return High;
end if;
return X;
end Clamp;
X > High को X >= High करने वाला mutant उसी वजह से equivalent है जो Max में थी। जब X बराबर High हो, दोनों same value लौटाते हैं।
X < Low को X <= Low करने वाला mutant पहली नज़र में वैसा ही लगता है, लेकिन equivalent नहीं है। क्योंकि जिस call में Low, High से बड़ा हो, उसमें result बदल जाता है। Clamp (5, 5, 3) में original code के लिए 5 < 5 false है, इसलिए वह अगली condition पर जाता है, और 5 > 3 true है, इसलिए 3 लौटाता है। Mutant 5 लौटाता है, क्योंकि उसमें 5 <= 5 true हो जाता है।
flowchart TB
accTitle: Clamp को upper limit से बड़ी lower limit देने पर original code और mutant का फ़र्क
accDescr: Clamp को 5, lower limit 5 और upper limit 3 देने पर original code में पहली condition false और अगली true होती है और वह upper limit 3 लौटाता है, जबकि comparison बदले हुए mutant में पहली condition true होती है और वह lower limit 5 लौटाता है, यह दिखाता है।
A["Clamp (5, 5, 3) call करें"] --> B["Original code: पहली condition false"]
A --> C["Mutant: पहली condition true"]
B --> D["अगली condition true, इसलिए upper limit 3 लौटाता है"]
C --> E["Lower limit 5 लौटाता है"]
चित्र 5: जिस call में lower limit, upper limit से बड़ी हो, उसमें original code और mutant के results अलग होते हैं।
यह mutant tests की कमी से ज़्यादा उस जगह की ओर इशारा करता है जहाँ specification तय नहीं है। Clamp में यह precondition नहीं है कि Low, High से छोटा या बराबर हो। उल्टी lower और upper limit वाली call allowed है या नहीं, और allowed है तो क्या लौटाना चाहिए, यह न code से समझ आता है न tests से।
यहाँ हमने current behaviour (upper limit लौटाना) को specification मानकर एक test जोड़ा।
Check (Clamp (5, 5, 3) = 3, "Clamp inverted range");
Score 95.00% हो गया और survive करने वाले सिर्फ़ 2 equivalent mutants बचे। अगर आप तय करते हैं कि उल्टी call allowed नहीं है, तो precondition जोड़कर इस mutant को equivalent मानकर exclude करने का तरीका भी है।
Equivalent mutants को comment से exclude किया जा सकता है।
-- adamutant:disable-next-line EqualityOperator: equivalent mutant
if A > B then
2 जगह यह comment लगाकर चलाने का result नीचे की table की चौथी row है। यह comment उस line के सभी comparison operator mutants को exclude करता है। हर line पर 2 mutants हैं, इसलिए 4 exclude हुए। उनमें से 2 exclude करने से पहले detect हो रहे थे।
| Run | Score | Detected | Survived | Excluded |
|---|---|---|---|---|
| Sample जैसा है | 77.50% | 31 | 9 | 0 |
| Boundary के 4 tests जोड़े | 92.50% | 37 | 3 | 0 |
| उल्टी lower और upper limit वाला test जोड़ा | 95.00% | 38 | 2 | 0 |
| Equivalent mutants को comment से exclude किया | 100.00% | 36 | 0 | 4 |
flowchart TB
accTitle: Survive हुए mutants को छाँटना
accDescr: Survive हुए mutant को पढ़कर जाँचते हैं कि क्या कोई input है जिस पर behaviour original code से अलग हो, अगर है तो specification तय करके उस फ़र्क को check करने वाला test जोड़ते हैं, और नहीं है तो उसे equivalent mutant मानकर comment से exclude करते हैं, यह दिखाता है।
A["Survive हुए mutant को पढ़ें"] --> B["क्या original code से अलग behaviour वाला input है"]
B -->|"है"| C["Specification तय करें, फ़र्क check करने वाला test जोड़ें"]
B -->|"नहीं"| D["Equivalent mutant मानकर comment से exclude करें"]
चित्र 6: Survivors दो तरह के होते हैं: tests या specification की कमी दिखाने वाले, और equivalent mutants।
कौन-सा किस तरह का है, यह इंसान तय करता है। यह लेख लिखते समय भी मैंने पहले Clamp वाले एक mutant को गलती से equivalent समझ लिया था। Score के number से ज़्यादा काम की बात यह है कि हर survive हुआ mutant क्या दिखा रहा है।
Proof से mutants detect करना
SPARK code में tests की जगह GNATprove के proof से mutants detect किए जा सकते हैं। examples/spark_counter ऐसा sample है जिसमें कोई test नहीं है, सिर्फ़ proof use होता है।
function Saturating_Add (A, B : Count) return Count
with Post =>
(if A + B <= Max then Saturating_Add'Result = A + B
else Saturating_Add'Result = Max);
Configuration में test की जगह prove लिखें। अगर test और prove दोनों लिखे हों, तो सिर्फ़ उन mutants को proof पर भेजा जाता है जिन पर tests pass हुए। नीचे configuration file का एक हिस्सा है।
mutate = ["src/**/*.adb"]
build = "gprbuild -p -q -c -P counters.gpr"
prove = "gnatprove -P counters.gpr --level=1 --report=fail --checks-as-errors=on -j1"
चलाने पर 8 में से 7 mutants proof से detect हुए और 1 survive कर गया। Score 87.50% रहा और 25 seconds लगे।
Body यह है।
function Saturating_Add (A, B : Count) return Count is
begin
if A + B > Max then
return Max;
else
return A + B;
end if;
end Saturating_Add;
return A + B को return A - B करने पर postcondition prove नहीं हो पाती। GNATprove fail होता है, इसलिए यह mutant detect हुआ माना जाता है। Postcondition result की value तय करती है, इसलिए body के ज़्यादातर बदलाव proof failure बन जाते हैं। Detect हुए 7 में से 5 में postcondition prove नहीं हुई, और बाकी 2 में सिर्फ़ वह check prove नहीं हुआ कि value type की range में रहती है।
Survive हुआ 1 mutant if A + B > Max then को if A + B >= Max then करने वाला है। जब A + B बराबर Max हो, original code A + B लौटाता है और mutant Max लौटाता है। Value same है, इसलिए यह equivalent mutant है।
Contracts (Pre या Post) को ही बदलने वाले mutants default रूप से नहीं बनते। Configuration में mutate_contracts = true करने पर बनते हैं।
flowchart TB
accTitle: Proof से mutants detect करने का flow
accDescr: Body में mutant डालकर GNATprove चलाते हैं, proof fail हो तो detect माना जाता है और proof pass हो तो mutant survive करता है, यह दिखाता है।
A["Body में mutant डालें"] --> B["GNATprove चलाएँ"]
B -->|"Proof fail होता है"| C["Killed: proof ने बदलाव detect किया"]
B -->|"Proof pass होता है"| D["Survived"]
चित्र 7: अगर contract result की value तय करता है, तो body का बदलाव proof failure के रूप में सामने आता है।
Mutants को एक साथ build करना
Mutation testing में समय लगता है। हर mutant के लिए दोबारा build करें, तो जितने mutants उतने builds चाहिए।
AdaMutant जिन mutants को साथ रखा जा सकता है, उन्हें एक source में डालकर एक बार में build करता है। README इस तरीके को mutant schemata कहता है।1 नीचे sample run के दौरान बने source का एक हिस्सा है।
function Add (A, B : Integer) return Integer is
begin
case ADAMUTANT_ACTIVE_1 is
when 1 =>
return A - B;
when others =>
return A + B;
end case;
end Add;
ADAMUTANT_ACTIVE_1 एक function है जो environment variable ADAMUTANT_MUTANT_ID की value लौटाता है। Test चलाते समय यह environment variable बदलकर, बिना दोबारा build किए active mutant switch किया जा सकता है। Value 0 होने पर कोई भी mutant active नहीं होता। Condition वाले mutants case expression बन जाते हैं।
if (case ADAMUTANT_ACTIVE_1 is
when 2 => (
True
),
when 3 => (
False
),
when 4 => (
A >= B
),
when 5 => (
A <= B
),
when others => (
A > B
)) then
calculator sample में 40 में से 36 mutants एक ही build में आ गए। Simple statements और conditions के 32 mutants थे, और expression function Is_Even के 4। बाकी 4 एक-एक करके build हुए: declaration की initial value बदलने वाले 2 और statement हटाने वाले 2। बिना बदलाव वाले build को मिलाकर कुल 6 builds हुए।
कुछ mutants को साथ न रखने की वजह है। README के अनुसार declarations के अंदर के mutants को कभी-कभी static expression चाहिए होता है, इसलिए उन्हें runtime पर switch नहीं किया जा सकता। Statement deletion को साथ इसलिए नहीं रखा जाता क्योंकि साथ रखने पर optimization की वजह से mutant original program जैसा behave कर सकता है, और जो detect होना चाहिए था वह छूट सकता है।1
flowchart TB
accTitle: एक साथ build होने वाले और एक-एक करके build होने वाले mutants
accDescr: Simple statements या conditions के mutants एक source में डालकर एक बार build होते हैं और test के समय environment variable से switch होते हैं, जबकि declarations के अंदर के mutants और statement deletion एक-एक करके build होते हैं, यह दिखाता है।
A["Mutant की जगह देखें"] --> B["Simple statement, condition, expression function"]
A --> C["Declaration के अंदर, statement deletion वगैरह"]
B --> D["एक source में डालकर एक बार build करें"]
D --> E["Environment variable से mutant switch करके test करें"]
C --> F["एक-एक करके build और test करें"]
चित्र 8: जिन mutants को साथ रखा जा सकता है, उनके लिए एक ही build काफ़ी है।
Pull request में सिर्फ़ बदली हुई lines check करना
बड़े project में हर बार सारे mutants check करना भारी काम है। --since देने पर, दी गई revision और HEAD के merge base से बदली हुई lines के mutants ही check होते हैं।
Try करने के लिए sample को git repository बनाया और एक branch में Grade के 60 को 70 कर दिया।
adamutant run --since main
File | Score % | Killed | Timeout | Survived | No cov | Compile | Ignored
---------------------------------------------------------------------------------------
All files | 40.00 | 2 | 0 | 3 | 0 | 0 | 31
src/calculator.adb | 40.00 | 2 | 0 | 3 | 0 | 0 | 31
Mutation score: 40.00% (2 detected, 3 undetected, 0 compile errors, 31 ignored) in 1 s
error: the mutation score is below the break threshold 50%
बदली हुई 1 line से जुड़े सिर्फ़ 5 mutants चले, और उसी file के बाकी 31 excluded रहे। बिना बदलाव वाली calculator.ads load ही नहीं हुई, और उसके 4 mutants list में भी नहीं दिखे। 1 second लगा।
Score 40% रहा, जो configuration की break threshold (50%) से कम है, इसलिए exit code 2 आया। Exit codes हैं: success पर 0, error पर 1, और threshold से कम होने पर 2। CI में चलाएँ, तो ऐसे pull requests रोके जा सकते हैं जिनमें बदली हुई lines के tests काफ़ी नहीं हैं। README के अनुसार GitHub Actions में history चाहिए होती है, इसलिए actions/checkout में fetch-depth: 0 देना चाहिए।
flowchart TB
accTitle: सिर्फ़ बदली हुई lines check करने का flow
accDescr: दी गई revision और HEAD के merge base से diff लेकर बदली हुई lines निकालते हैं, उन lines से जुड़े mutants ही चलाते हैं, बाकी exclude करते हैं, और score threshold से कम हो तो exit code 2 के साथ run ख़त्म होता है, यह दिखाता है।
A["Merge base से diff लें"] --> B["बदली हुई lines से जुड़े mutants ही चलाएँ"]
B --> C["Score सिर्फ़ बदली हुई lines पर calculate करें"]
C -->|"Threshold या उससे ज़्यादा"| D["Exit code 0"]
C -->|"Threshold से कम"| E["Exit code 2"]
चित्र 9: Score सिर्फ़ बदली हुई lines के mutants पर calculate होता है, और threshold से CI रोका जा सकता है।
States और score
Mutant की 7 states होती हैं।1
| State | मतलब | Score में कैसे गिना जाता है |
|---|---|---|
| Killed | Test या proof fail हुआ | Detected |
| Timeout | Test time limit में ख़त्म नहीं हुआ | Detected |
| Survived | Test और proof दोनों pass हुए | Undetected |
| NoCoverage | Build उस file को compile नहीं करता | Undetected |
| CompileError | Mutant build नहीं हो पाया | Excluded |
| RuntimeError | Command start नहीं हो पाई, वगैरह | Excluded |
| Ignored | Comment वगैरह से exclude किया गया | Excluded |
Score, detected mutants की संख्या को detected और undetected के कुल से divide करके निकलता है।
flowchart TB
accTitle: Equivalent mutants exclude करने वाले run में score की calculation
accDescr: Equivalent mutants को comment से exclude करने वाले run में Killed के 34 और Timeout के 2 मिलाकर 36 detected हैं और undetected 0 है, इसलिए 36 को 36 से divide करके 100 percent आता है, और excluded 4 calculation में नहीं आते, यह दिखाता है।
A["Killed 34 और Timeout 2"] --> D["Detected: 36"]
B["Survived और NoCoverage: 0"] --> E["Undetected: 0"]
D --> F["36 ÷ (36 + 0) = 100.00%"]
E --> F
C["Ignored: 4"] --> G["Calculation में शामिल नहीं"]
चित्र 10: Exclude किए गए 4 mutants न numerator में आते हैं, न denominator में।
Use करने से पहले जानने वाली बातें
README में लिखी limitations और assumptions में से वे बातें, जिन्हें adopt करने से पहले जान लेना अच्छा है।1
- एक साथ build करने के लिए ज़रूरी है कि test program का main Ada में लिखा हो, और build GNAT की ALI files छोड़े। ये conditions पूरी न हों, तो सभी mutants एक-एक करके build होते हैं।
- जिन projects में warnings को errors माना जाता है, उनमें एक साथ build और एक-एक build के बीच यह बदल सकता है कि कौन-से mutants compile error देते हैं। एक साथ बनाए गए source में style checks off रहते हैं, और पूरी file देखकर आने वाली warnings भी नहीं आतीं।
- Loop count बदलने वाले mutants बहुत ज़्यादा memory allocate कर सकते हैं।
test_memory_limit_mbसे हर test process की memory limit तय की जा सकती है। - Windows पर test command में
/वाला path लिखें, तो उसे quotes में रखना ज़रूरी है।
Version 0.1.0 है। इस लेख में जो check किया गया, वह है Linux पर साथ आने वाले 2 samples और --since का behaviour।
सारांश
- AdaMutant, Ada और SPARK के source में छोटे बदलाव डालकर check करता है कि tests या GNATprove के proofs उन्हें detect कर पाते हैं या नहीं।
- साथ आने वाले sample में 40 में से 9 mutants survive कर गए। Boundary के 4 tests जोड़ने पर survivors 3 रह गए। उनमें से 2 equivalent mutants थे, और 1 ऐसी जगह दिखा रहा था जहाँ specification तय नहीं थी।
- Tests के बिना SPARK code में भी सिर्फ़ proof से 8 में से 7 mutants detect हो गए।
- जिन mutants को साथ रखा जा सकता है, उन्हें एक build में निपटाया जाता है और test के समय environment variable से switch किया जाता है।
--sinceसे सिर्फ़ बदली हुई lines के mutants check करके threshold के आधार पर CI रोका जा सकता है।
संबंधित लेख
- Testing Your Tests with Mutation Testing ── Finding Tests That Check Nothing with Stryker.NET
- Can You Trust Tests Written by AI? ── How to Spot Tests That Pass Without Checking Anything
- Introduction to Formal Verification with SPARK — From Ada Contracts to Mathematical Proof
- Proving AI-Written Code with SPARK ── Humans Write the Contracts, GNATprove Checks Them
संदर्भ
-
KomuraSoft, AdaMutant (README.ja.md). Reference किए गए हिस्से: शुरुआत की features list, और “Usage”, “Mutants”, “States and score”, “How it works”, “Batched mutant builds” sections। यह लेख commit
22c0fcb(15 November 2026) के content पर check किया गया। ↩ ↩2 ↩3 ↩4 ↩5 ↩6 -
Alire, mutant. Reference किए गए हिस्से: crate का नाम (mutant), version (0.1.0), license (Apache-2.0), dependency (gnat >=14), और description का “AdaMutant runs on Linux, macOS and Windows.”। 17 November 2026 को check किया। ↩ ↩2
संबंधित लेख
निकटवर्ती विषयों में गहराई से जाने के लिए समान टैग वाले नवीनतम लेख।
Alire से Ada project शुरू करना ── project बनाना, dependencies जोड़ना, build profiles और GNATprove तक
Ada के package manager Alire से project बनाना, GNAT अपने-आप लाना, dependency crates जोड़ना, build profile बदलना और GNATprove से proof करन...
Ada में generic programming — type पर contract लिखकर zero-cost reuse
Ada की generic programming को generic subprogram, generic package, formal subprogram, type category और practical design guidelines तक sys...
MIL-STD-882E software safety को कैसे handle करता है?
MIL-STD-882E software failure की probability estimate नहीं करता। Software कितना control रखता है और नुकसान कितना गंभीर हो सकता है, इससे an...
Ada में memory management ── access types, controlled types और storage pools का सही इस्तेमाल
Ada GC पर निर्भर नहीं रहता: values पहले stack पर रखी जाती हैं, और heap चाहिए तो access types lifetime के rules type में लिख देते हैं। Dea...
Ada में real-time systems programming — priority, period और execution time control
Ada के Annex D (Real-Time Systems) को 8 practical code examples से सीखें। Task priority, Ceiling_Locking, delay until से periodic executi...
संबंधित विषय
ये इस विषय से जुड़े topic पृष्ठ हैं। लेख से शुरू करके आप संबंधित सेवाओं और दूसरे लेखों तक जा सकते हैं।
Windows के तकनीकी विषय
Windows विकास, बग जाँच और मौजूदा संपत्तियों के उपयोग से जुड़े तकनीकी विषयों का प्रवेश-द्वार।
इस विषय से जुड़ी सेवाएँ
यह लेख नीचे दिए गए सेवा पृष्ठों से जुड़ता है। जो प्रवेश-बिंदु आपके सबसे क़रीब हो, वहाँ से देखिए।
तकनीकी परामर्श और डिज़ाइन समीक्षा
Ada या SPARK code में tests और proofs कौन-से बदलाव पकड़ पाते हैं और कहाँ कमी है, यह जाँचकर कौन-से tests या contracts जोड़ने हैं यह तय करना, हम technical consultation और design review के रूप में ले सकते हैं।
त्रुटि जाँच और मूल कारण विश्लेषण
Tests pass होने के बावजूद bug आए, तो उन tests ने क्या check नहीं किया था, इसकी जाँच हम bug investigation और root cause analysis के रूप में कर सकते हैं।
अक्सर पूछे जाने वाले प्रश्न
इस लेख के विषय पर परामर्श में अक्सर पूछे जाने वाले प्रश्न।
- AdaMutant क्या करता है?
- यह Ada और SPARK के source में automatically छोटे बदलाव (mutants) डालता है और check करता है कि tests या GNATprove के proofs उन बदलावों को detect कर पाते हैं या नहीं। जितने बदलाव detect हुए, उनका percentage mutation score के रूप में दिखाता है। KomuraSoft इसे Apache License 2.0 के तहत publish करता है।
- क्या इसे ऐसे SPARK code पर use कर सकते हैं जिसमें tests नहीं हैं, सिर्फ़ proofs हैं?
- हाँ। Configuration के prove में GNATprove command लिखें, तो जिन mutants पर proof fail होता है उन्हें detect हुआ माना जाता है। साथ आने वाले sample में बिना tests के 8 में से 7 mutants proof से detect हुए, और बचा हुआ 1 equivalent mutant था, जो original code जैसा ही behave करता है।
- क्या mutation score को 100% तक ले जाना चाहिए?
- Score को target number बनाने से बेहतर है कि survive हुए mutants को एक-एक करके पढ़ा जाए। Survivors में ऐसे mutants भी होते हैं जो tests या specification की कमी दिखाते हैं, और ऐसे भी जो original code जैसा ही behave करते हैं और इसलिए detect नहीं हो सकते (equivalent mutants)। कौन-सा किस तरह का है, यह इंसान तय करता है।
लेखक की प्रोफ़ाइल
लेख के लेखक का परिचय पृष्ठ।
Go Komura
KomuraSoft LLC के प्रतिनिधि
Windows सॉफ़्टवेयर विकास, तकनीकी परामर्श और बग जाँच पर केंद्रित; जिन परियोजनाओं में मौजूदा assets बचे हैं, उनमें और जिन खराबियों का कारण आसानी से नहीं दिखता, उनकी जाँच में हमारी विशेष ताकत है।