This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
func assert<T: Equatable>(_ json: Data, hasKey expectedKey: String, andValue expectedValue: T, at index: Int = 0, file: StaticString = #filePath, line: UInt = #line) { | |
guard let json = try? JSONSerialization.jsonObject(with: json) as? [String: Any] else { | |
return XCTFail("input is not a valid json object", file: file, line: line) | |
} | |
guard let receivedValue = json[expectedKey] as? T else { | |
return XCTFail("json has no key \"\(expectedKey)\"", file: file, line: line) | |
} | |
XCTAssertEqual( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var natPolicy = linphone_core_get_nat_policy(lc) | |
Log.d("ice_enabled " + linphone_nat_policy_ice_enabled(natPolicy)) | |
Log.d("stun_enabled " + linphone_nat_policy_stun_enabled(natPolicy)) | |
Log.d("get_stun_server " + linphone_nat_policy_get_stun_server(natPolicy)) | |
Log.d("turn_enabled " + linphone_nat_policy_turn_enabled(natPolicy)) | |
Log.d("tcp_turn_transport_enabled " + linphone_nat_policy_tcp_turn_transport_enabled(natPolicy)) | |
Log.d("udp_turn_transport_enabled " + linphone_nat_policy_udp_turn_transport_enabled(natPolicy)) | |
Log.d("tls_turn_transport_enabled " + linphone_nat_policy_tls_turn_transport_enabled(natPolicy)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
String s1 = | |
'./values-IT/strings.xml:374: <string name="accepted-terms">Termini "accettati" <ok> ciao</string>'; | |
RegExp regExp = RegExp(r'^(.*)\s+<string name="(.*)">(.*)<\/string>'); | |
Iterable<Match> matches = regExp.allMatches(s1); | |
for (Match match in matches) { | |
print("input --> ${match.group(0)}"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int count_ones(unsigned long long n) { | |
int ones = 0; | |
while(n != 0) { | |
bool is_one = (n & 1UL) == 1UL; | |
if (is_one) { | |
ones++; | |
} | |
n = n >> 1; | |
} |