Skip to content

Commit

Permalink
More tests...
Browse files Browse the repository at this point in the history
  • Loading branch information
jleben committed Feb 5, 2020
1 parent 40bd410 commit 77f9519
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ project(protobuf-spec-comparator)
add_executable(protobuf-spec-compare comparison.cpp main.cpp)
target_link_libraries(protobuf-spec-compare protoc protobuf)

enable_testing()

add_subdirectory(tests)
12 changes: 12 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@

add_executable(run-tests test.cpp ../comparison.cpp)
target_link_libraries(run-tests protoc protobuf)

function(add_comparison_test dir_name)
message(STATUS "Adding test ${dir_name}")
add_test(NAME "${dir_name}" COMMAND
run-tests "${dir_name}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
endfunction()

add_comparison_test(msg_added)
add_comparison_test(msg_removed)
add_comparison_test(enum_added)
add_comparison_test(enum_removed)
5 changes: 5 additions & 0 deletions tests/enum_added/a.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
syntax = "proto2";

package Test;


7 changes: 7 additions & 0 deletions tests/enum_added/b.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
syntax = "proto2";

package Test;

enum E {
V = 1;
}
10 changes: 10 additions & 0 deletions tests/enum_added/diff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "/",
"items": [
{
"type": "file_enum_added",
"a": "",
"b": "Test.E"
}
]
}
7 changes: 7 additions & 0 deletions tests/enum_removed/a.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
syntax = "proto2";

package Test;

enum E {
V = 1;
}
3 changes: 3 additions & 0 deletions tests/enum_removed/b.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
syntax = "proto2";

package Test;
10 changes: 10 additions & 0 deletions tests/enum_removed/diff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "/",
"items": [
{
"type": "file_enum_removed",
"a": "Test.E",
"b": ""
}
]
}
1 change: 1 addition & 0 deletions tests/msg_added/diff.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"items": [
{
"type": "file_message_added",
"a": "",
"b": "Test.M"
}
]
Expand Down
1 change: 0 additions & 1 deletion tests/msg_added/test.cpp

This file was deleted.

7 changes: 7 additions & 0 deletions tests/msg_removed/a.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
syntax = "proto2";

package Test;

message M {
}

3 changes: 3 additions & 0 deletions tests/msg_removed/b.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
syntax = "proto2";

package Test;
10 changes: 10 additions & 0 deletions tests/msg_removed/diff.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"type": "/",
"items": [
{
"type": "file_message_removed",
"a": "Test.M",
"b": ""
}
]
}

0 comments on commit 77f9519

Please sign in to comment.