Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[DOCUMENT]
TITLE: Hello world doc

[REQUIREMENT]
UID: REQ-1
TITLE: Requirement Title
STATEMENT: Requirement Statement

[REQUIREMENT]
UID: REQ-2
TITLE: Requirement Title #2
STATEMENT: Requirement Statement #2
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[DOCUMENT]
MID: c2d4542d5f1741c88dfcb4f68ad7dcbd
TITLE: Requirements from Source Nodes
UID: SRC-NODES-BASE
OPTIONS:
RELATION_FIELD: MID

[GRAMMAR]
ELEMENTS:
- TAG: SECTION
PROPERTIES:
IS_COMPOSITE: True
FIELDS:
- TITLE: UID
TYPE: String
REQUIRED: False
- TITLE: TITLE
TYPE: String
REQUIRED: True
- TAG: REQUIREMENT
PROPERTIES:
VIEW_STYLE: Narrative
FIELDS:
- TITLE: MID
TYPE: String
REQUIRED: False
- TITLE: TITLE
TYPE: String
REQUIRED: False
- TITLE: FOO
TYPE: String
REQUIRED: False
- TITLE: BAR
TYPE: String
REQUIRED: False
RELATIONS:
- TYPE: Parent
- TYPE: File

[[SECTION]]
TITLE: Merge example.c into static nodes

[REQUIREMENT]
MID: 3bd0162d-d6d2-42a1-9324-ab8415190970
TITLE: TITLE from sdoc
FOO: FOO text from sdoc
BAR: BAR text from sdoc
RELATIONS:
- TYPE: Parent
VALUE: REQ-1

[[/SECTION]]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>

/**
* Some text.
*
* @relation(REQ-1, scope=function)
*
* MID: 3bd0162d-d6d2-42a1-9324-ab8415190970
*
* FOO: FOO text from example.c
*
* BAR: BAR text from example.c
*/
void example_1(void) {
print("hello world\n");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[project]

features = [
"REQUIREMENT_TO_SOURCE_TRACEABILITY",
"SOURCE_FILE_LANGUAGE_PARSERS",
]

source_nodes = [
{ "src/" = { uid = "SRC-NODES-BASE", node_type = "REQUIREMENT" } }
]

exclude_source_paths = [
"test.itest"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# This test verifies that a source nodes is merged with a static SDoc node with
# same explicit MID annotated, specifically when neither the SDoc node nor the
# source code node have any UID field defined.
#
# @relation(SDOC-SRS-141, scope=file)
#

RUN: %strictdoc --debug export %S --output-dir %T | filecheck %s

CHECK: Published: Hello world doc

RUN: %check_exists --file "%T/html/_source_files/src/example.c.html"

RUN: %cat %T/html/%THIS_TEST_FOLDER/source_node_base.html | filecheck %s --check-prefix CHECK-HTML
CHECK-HTML: Requirements from Source Nodes
CHECK-HTML: 3bd0162d-d6d2-42a1-9324-ab8415190970
CHECK-HTML: TITLE from sdoc
CHECK-HTML: src/example.c, <i>lines: 3-16</i>, function example_1()
CHECK-HTML-NOT: FOO text from sdoc
CHECK-HTML: FOO text from example.c
CHECK-HTML-NOT: BAR text from sdoc
CHECK-HTML: BAR text from example.c

RUN: %cat %T/html/_source_files/src/example.c.html | filecheck %s --check-prefix CHECK-SOURCE-FILE
CHECK-HTML-NOT: SRC-NODES-BASE/src/example.c/example_1
CHECK-SOURCE-FILE: 3bd0162d-d6d2-42a1-9324-ab8415190970

RUN: %cat %T/html/source_coverage.html | filecheck %s --check-prefix CHECK-SOURCE-COVERAGE
CHECK-SOURCE-COVERAGE: 100.0